Macro XSET (from Fraktal SAS Programming): Unterschied zwischen den Versionen
Zur Navigation springen
Zur Suche springen
K |
K |
||
Zeile 31: | Zeile 31: | ||
| | | | ||
<font face="Courier New"> | <font face="Courier New"> | ||
− | ;data | + | ;data ecotope / view = ecotope; |
</font> | </font> | ||
− | | | + | | |
|- | |- | ||
| | | | ||
Zeile 76: | Zeile 76: | ||
</font> | </font> | ||
|End condition on macro parameter ''xvar'' | |End condition on macro parameter ''xvar'' | ||
+ | |- | ||
+ | | | ||
+ | <font face="Courier New"> | ||
+ | ;run; | ||
+ | | | ||
+ | |- | ||
+ | |- | ||
+ | | | ||
+ | <font face="Courier New"> | ||
+ | ;proc sql noprint; | ||
+ | | | ||
+ | |- | ||
+ | |- | ||
+ | | | ||
+ | <font face="Courier New"> | ||
+ | :select xvar | ||
+ | | | ||
+ | |- | ||
+ | |- | ||
+ | | | ||
+ | <font face="Courier New"> | ||
+ | : into :xvar_l separated by ' ' | ||
+ | | | ||
+ | |- | ||
+ | |- | ||
+ | | | ||
+ | <font face="Courier New"> | ||
+ | : from ecotope | ||
+ | | | ||
+ | |- | ||
+ | |- | ||
+ | | | ||
+ | <font face="Courier New"> | ||
+ | : ; | ||
+ | | | ||
+ | |- | ||
+ | |- | ||
+ | | | ||
+ | <font face="Courier New"> | ||
+ | ;quit; | ||
+ | | | ||
+ | |- | ||
+ | |- | ||
+ | | | ||
+ | <font face="Courier New"> | ||
+ | :%GLOBAL &XVAR_L.; | ||
+ | | | ||
+ | |- | ||
+ | |- | ||
+ | | | ||
+ | <font face="Courier New"> | ||
+ | ;data _NULL_; | ||
+ | </font> | ||
+ | |Start datastep run group | ||
+ | |- | ||
+ | | | ||
+ | <font face="Courier New"> | ||
+ | : set ecotope; | ||
+ | | | ||
+ | |- | ||
|- | |- | ||
| | | | ||
Zeile 91: | Zeile 151: | ||
| | | | ||
<font face="Courier New"> | <font face="Courier New"> | ||
− | + | ;filename path clear; | |
</font> | </font> | ||
|Close source for text data | |Close source for text data |
Version vom 11. August 2014, 15:18 Uhr
This SAS Macro transfers the environment from the particular operating system to SAS Macro variables.
- Characters "not appreciated" by SAS are removed from variable values.
- If a specific variable name is supplied, this will be the only one transferred.
Code executed | Function performed |
---|---|
|
Start Macro definition with name and positional parameter xvar |
|
Open source for text data of type pipe pointing to OS command |
|
|
|
Declare variables xvar and xval by length in bytes |
|
Utilize data stream from data source path |
|
Define structure of data stream path with variables xvar and xval |
|
Remove unwanted characters from variable xvar |
|
Specify condition on macro parameter xvar for using code segment |
|
Conditionally executed code |
|
End condition on macro parameter xvar |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Start datastep run group |
|
|
|
Transfer variable values to symbol table |
|
End data step run group |
|
Close source for text data |
|
End Macro definition with name |