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