Macro rXDIR (from Fraktal SAS Programming): Unterschied zwischen den Versionen

Aus phenixxenia.org
Zur Navigation springen Zur Suche springen
K
K
Zeile 135: Zeile 135:
 
|
 
|
 
<font face="Courier New">  
 
<font face="Courier New">  
:%RXDIR(&RPATH.)
+
;filename path clear;
 
</font>  
 
</font>  
 
|
 
|
Zeile 141: Zeile 141:
 
|
 
|
 
<font face="Courier New">  
 
<font face="Courier New">  
:%LEAVE:
+
:%RXDIR(&RPATH.)
 
</font>  
 
</font>  
 
|
 
|
Zeile 147: Zeile 147:
 
|
 
|
 
<font face="Courier New">  
 
<font face="Courier New">  
;filename path clear;
+
:%LEAVE:
 
</font>  
 
</font>  
 
|
 
|

Version vom 3. September 2014, 15:44 Uhr

Zurück

Übersicht

Vorwärts

What it does

This SAS Macro provides the function from XDIR in an interactive mode.

  • The recursive use of macro invocation keeps the macro "alive" until no further user input is made.
  • It might be of some interest to the novice user, how easy it is, to turn a simple "home-grew" function into an interactive tool.
Code executed Function performed

%MACRO rxdir(xpath);

%GLOBAL rpath;

%LET xpath = ;

%WINDOW path

irow = 20 rows = 14 icolumn = 130 columns = 64

#3 @5 "Current Path: &RPATH."

#5 @5 'Enter path: ' xpath 40 attr = blink

 ;

%DISPLAY path;

%IF %LENGTH(&XPATH.) = 0 %THEN %GOTO leave;

%LET rpath = &RPATH.&XPATH.\;

filename path pipe "dir /b ""&RPATH.""" lrecl = 256;

%PUT ---&RPATH.---;

data _NULL_;

length entry $256;

infile path length = lrecl;

input entry $varying256. lrecl;

put entry;

run;

filename path clear;

%RXDIR(&RPATH.)

%LEAVE:

%LET rpath = ;

%MEND rxdir;

END macro definition with name

Zurück

Übersicht

Vorwärts