Macro XEDIT (from Fraktal SAS Programming): Unterschied zwischen den Versionen
Zur Navigation springen
Zur Suche springen
K |
K |
||
Zeile 14: | Zeile 14: | ||
|- | |- | ||
| | | | ||
+ | <font face="Courier New"> | ||
;%MACRO xedit(xentry,xpath); | ;%MACRO xedit(xentry,xpath); | ||
+ | </font> | ||
|Start macro definition with name and positional parameters ''xentry'' and ''xpath''. | |Start macro definition with name and positional parameters ''xentry'' and ''xpath''. | ||
− | |- | + | |- |
| | | | ||
+ | <font face="Courier New"> | ||
:%LOCAL xpath; | :%LOCAL xpath; | ||
+ | </font> | ||
|Declare scope for ''xpath'' to be local. | |Declare scope for ''xpath'' to be local. | ||
− | |- | + | |- |
| | | | ||
+ | <font face="Courier New"> | ||
;%IF %LENGTH(&XPATH.) = 0 %THEN %DO; | ;%IF %LENGTH(&XPATH.) = 0 %THEN %DO; | ||
+ | </font> | ||
|Start branch for condition "''xpath'' not specified". | |Start branch for condition "''xpath'' not specified". | ||
|- | |- | ||
| | | | ||
+ | <font face="Courier New"> | ||
:%XSET(homeshare); | :%XSET(homeshare); | ||
+ | </font> | ||
|Call macro ''XSET'' to obtain user's home directory. | |Call macro ''XSET'' to obtain user's home directory. | ||
|- | |- | ||
| | | | ||
+ | <font face="Courier New"> | ||
:%LET xpath = &HOMESHARE.; | :%LET xpath = &HOMESHARE.; | ||
+ | </font> | ||
|Populate ''xpath'' with content from ''homeshare''. | |Populate ''xpath'' with content from ''homeshare''. | ||
|- | |- | ||
| | | | ||
+ | <font face="Courier New"> | ||
;%END; | ;%END; | ||
+ | </font> | ||
|End branch for condition "''xpath'' not specified". | |End branch for condition "''xpath'' not specified". | ||
|- | |- | ||
| | | | ||
+ | <font face="Courier New"> | ||
;filename path "&XPATH"; | ;filename path "&XPATH"; | ||
+ | </font> | ||
|Create file reference using ''xpath''. | |Create file reference using ''xpath''. | ||
|- | |- | ||
| | | | ||
+ | <font face="Courier New"> | ||
;%IF %LENGTH(&XENTRY.) != 0 %THEN %DO; | ;%IF %LENGTH(&XENTRY.) != 0 %THEN %DO; | ||
+ | </font> | ||
|Start branch for condition "''xentry'' is not empty". | |Start branch for condition "''xentry'' is not empty". | ||
|- | |- | ||
| | | | ||
+ | <font face="Courier New"> | ||
:DM "PGM"; | :DM "PGM"; | ||
+ | </font> | ||
|Open Program Editor window in '''''SAS''''' display manager. | |Open Program Editor window in '''''SAS''''' display manager. | ||
|- | |- | ||
| | | | ||
+ | <font face="Courier New"> | ||
:DM "inc path(&XENTRY.)"; | :DM "inc path(&XENTRY.)"; | ||
+ | </font> | ||
|Load text file specified by ''xentry'' from directory specified by ''xpath''. | |Load text file specified by ''xentry'' from directory specified by ''xpath''. | ||
|- | |- | ||
| | | | ||
+ | <font face="Courier New"> | ||
;%END; | ;%END; | ||
+ | </font> | ||
|End branch for condition "''xentry'' is not empty". | |End branch for condition "''xentry'' is not empty". | ||
|- | |- | ||
| | | | ||
+ | <font face="Courier New"> | ||
;%ELSE %DO; | ;%ELSE %DO; | ||
+ | </font> | ||
|Start branch for condition "''xentry'' is empty". | |Start branch for condition "''xentry'' is empty". | ||
|- | |- | ||
| | | | ||
+ | <font face="Courier New"> | ||
:%XDIR(&HOMESHARE.); | :%XDIR(&HOMESHARE.); | ||
+ | </font> | ||
|Call macro ''XDIR'' to show content in user's home directory. | |Call macro ''XDIR'' to show content in user's home directory. | ||
|- | |- | ||
| | | | ||
+ | <font face="Courier New"> | ||
;%END; | ;%END; | ||
+ | </font> | ||
|End branch for condition "''xentry'' is empty". | |End branch for condition "''xentry'' is empty". | ||
|- | |- | ||
| | | | ||
+ | <font face="Courier New"> | ||
;filename path clear; | ;filename path clear; | ||
+ | </font> | ||
|Clear fileref pointing to ''xpath''. | |Clear fileref pointing to ''xpath''. | ||
|- | |- | ||
| | | | ||
+ | <font face="Courier New"> | ||
;%MEND xedit; | ;%MEND xedit; | ||
+ | </font> | ||
|Finalize macro definition with name. | |Finalize macro definition with name. | ||
|} | |} |
Version vom 6. August 2014, 18:17 Uhr
Code executed | Function performed |
---|---|
|
Start macro definition with name and positional parameters xentry and xpath. |
|
Declare scope for xpath to be local. |
|
Start branch for condition "xpath not specified". |
|
Call macro XSET to obtain user's home directory. |
|
Populate xpath with content from homeshare. |
|
End branch for condition "xpath not specified". |
|
Create file reference using xpath. |
|
Start branch for condition "xentry is not empty". |
|
Open Program Editor window in SAS display manager. |
|
Load text file specified by xentry from directory specified by xpath. |
|
End branch for condition "xentry is not empty". |
|
Start branch for condition "xentry is empty". |
|
Call macro XDIR to show content in user's home directory. |
|
End branch for condition "xentry is empty". |
|
Clear fileref pointing to xpath. |
|
Finalize macro definition with name. |