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

Aus phenixxenia.org
Zur Navigation springen Zur Suche springen
K
K
Zeile 19: Zeile 19:
 
|
 
|
 
;%IF %LENGTH(&XPATH.) = 0 %THEN %DO;
 
;%IF %LENGTH(&XPATH.) = 0 %THEN %DO;
|
+
|Define branch when parameter ''xpath'' is not supplied.
 
|-
 
|-
 
|
 
|
 
;%WINDOW path  
 
;%WINDOW path  
|
+
|Start definition of pop-up window.
 
|-
 
|-
 
|
 
|
 
: irow = 20 rows = 14 icolumn = 30 columns = 64         
 
: irow = 20 rows = 14 icolumn = 30 columns = 64         
|
+
|Specify position and size of window.
 
|-
 
|-
 
|
 
|
 
: #4 @5 'Enter path: ' xpath 40 attr = underline                 
 
: #4 @5 'Enter path: ' xpath 40 attr = underline                 
|
+
|Specify constant text shown, parameter name to be populated and attributes.
 
|-
 
|-
 
|
 
|
 
; ;
 
; ;
|
+
|Terminate pop-up window definition statement.
 
|-
 
|-
 
|
 
|
 
:%DISPLAY path;
 
:%DISPLAY path;
|
+
|Open pop-up window.
 
|-
 
|-
 
|
 
|
 
;%END;
 
;%END;
|
+
|Finalize branch definition for empty parameter ''xpath''.
 
|-
 
|-
 
|
 
|
 
;filename path pipe "dir /b ""&XPATH.""" lrecl = 256;
 
;filename path pipe "dir /b ""&XPATH.""" lrecl = 256;
|
+
|Define text data stream with type '''''pipe''''' and logical record length.
 
|-
 
|-
 
|
 
|
 
;data _NULL_;
 
;data _NULL_;
|
+
|Initiate data step run group.
 
|-
 
|-
 
|
 
|
 
:length entry $256;
 
:length entry $256;
|
+
|Specify length in byte for character field ''entry''.
 
|-
 
|-
 
|
 
|
 
:infile path length = lrecl;
 
:infile path length = lrecl;
|
+
|Open text data stream ''path''.
 
|-
 
|-
 
|
 
|
 
:input entry $varying256. lrecl;
 
:input entry $varying256. lrecl;
|
+
|Specify structure of data stream ''path''.
 
|-
 
|-
 
|
 
|
 
:  put entry;  
 
:  put entry;  
|
+
|Write value from field ''entry'' to the SAS LOG screen.
 
|-
 
|-
 
|
 
|
 
;run;
 
;run;
|
+
|Terminate data step run group.
 
|-
 
|-
 
|
 
|
 
;filename path clear;
 
;filename path clear;
|
+
|Close text data stream.
 
|-
 
|-
 
|
 
|

Version vom 4. August 2014, 13:26 Uhr

Zurück

Übersicht

Vorwärts

Code executed Function performed
%MACRO xdir(xpath);
Start macro definition with name and positional parameter xpath.
%IF %LENGTH(&XPATH.) = 0 %THEN %DO;
Define branch when parameter xpath is not supplied.
%WINDOW path
Start definition of pop-up window.
irow = 20 rows = 14 icolumn = 30 columns = 64
Specify position and size of window.
#4 @5 'Enter path: ' xpath 40 attr = underline
Specify constant text shown, parameter name to be populated and attributes.
 ;
Terminate pop-up window definition statement.
%DISPLAY path;
Open pop-up window.
%END;
Finalize branch definition for empty parameter xpath.
filename path pipe "dir /b ""&XPATH.""" lrecl = 256;
Define text data stream with type pipe and logical record length.
data _NULL_;
Initiate data step run group.
length entry $256;
Specify length in byte for character field entry.
infile path length = lrecl;
Open text data stream path.
input entry $varying256. lrecl;
Specify structure of data stream path.
put entry;
Write value from field entry to the SAS LOG screen.
run;
Terminate data step run group.
filename path clear;
Close text data stream.
%MEND xdir;
END macro definition with name

Zurück

Übersicht

Vorwärts