Macro rXDIR (from Fraktal SAS Programming): Unterschied zwischen den Versionen
| KKeine Bearbeitungszusammenfassung | KKeine Bearbeitungszusammenfassung | ||
| Zeile 24: | Zeile 24: | ||
| </font>   | </font>   | ||
| | | | | ||
| Start macro definition with name and positional parameter ''xpath'' | |||
| |- | |- | ||
| | | | | ||
| Zeile 30: | Zeile 31: | ||
| </font>   | </font>   | ||
| | | | | ||
| Declare macrovariable ''rpath'' as global | |||
| |- | |- | ||
| | | | | ||
| Zeile 36: | Zeile 38: | ||
| </font>   | </font>   | ||
| | | | | ||
| Empty macrovariable ''xpath'' | |||
| |- | |- | ||
| | | | | ||
| Zeile 42: | Zeile 45: | ||
| </font>   | </font>   | ||
| | | | | ||
| Start definition for macro window ''path'' | |||
| |- | |- | ||
| | | | | ||
| Zeile 48: | Zeile 52: | ||
| </font>   | </font>   | ||
| | | | | ||
| Set coordinates for macro window ''path'' | |||
| |- | |- | ||
| | | | | ||
| Zeile 54: | Zeile 59: | ||
| </font>   | </font>   | ||
| | | | | ||
| Define 1st output line containing value from macrovariable ''rpath'' | |||
| |- | |- | ||
| | | | | ||
| Zeile 60: | Zeile 66: | ||
| </font>   | </font>   | ||
| | | | | ||
| Define 2nd output line and field attributes to read macrovariable ''xpath'' | |||
| |- | |- | ||
| | | | | ||
| Zeile 66: | Zeile 73: | ||
| </font>   | </font>   | ||
| | | | | ||
| End definition of macro window ''path'' | |||
| |- | |- | ||
| | | | | ||
| Zeile 72: | Zeile 80: | ||
| </font>   | </font>   | ||
| | | | | ||
| Invoke macro window ''path'' | |||
| |- | |- | ||
| | | | | ||
| Zeile 78: | Zeile 87: | ||
| </font>   | </font>   | ||
| | | | | ||
| Branch for condition "''null value entered''" | |||
| |- | |- | ||
| | | | | ||
| Zeile 84: | Zeile 94: | ||
| </font>   | </font>   | ||
| | | | | ||
| Append value from macrovariable ''xpath'' to macrovariable ''rpath'' | |||
| |- | |- | ||
| | | | | ||
| Zeile 90: | Zeile 101: | ||
| </font>   | </font>   | ||
| | | | | ||
| Create file reference of type ''pipe'' to read entries from directory named in ''rpath'' | |||
| |- | |- | ||
| | | | | ||
| Zeile 96: | Zeile 108: | ||
| </font>   | </font>   | ||
| | | | | ||
| Output roughly formatted header containing value from ''rpath'' | |||
| |- | |- | ||
| | | | | ||
| Zeile 102: | Zeile 115: | ||
| </font>   | </font>   | ||
| | | | | ||
| Initiate datastep w/o creating a dataset | |||
| |- | |- | ||
| | | | | ||
| Zeile 108: | Zeile 122: | ||
| </font>   | </font>   | ||
| | | | | ||
| Specify field length to read directory entries' names into  | |||
| |- | |- | ||
| | | | | ||
Version vom 24. November 2014, 16:45 Uhr
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 | 
|---|---|
| 
 
 
 | Start macro definition with name and positional parameter xpath | 
| 
 
 
 | Declare macrovariable rpath as global | 
| 
 
 
 | Empty macrovariable xpath | 
| 
 
 
 | Start definition for macro window path | 
| 
 
 
 | Set coordinates for macro window path | 
| 
 
 
 | Define 1st output line containing value from macrovariable rpath | 
| 
 
 
 | Define 2nd output line and field attributes to read macrovariable xpath | 
| ; | End definition of macro window path | 
| 
 
 
 | Invoke macro window path | 
| 
 
 
 | Branch for condition "null value entered" | 
| 
 
 
 | Append value from macrovariable xpath to macrovariable rpath | 
| 
 
 
 | Create file reference of type pipe to read entries from directory named in rpath | 
| 
 
 
 | Output roughly formatted header containing value from rpath | 
| 
 
 
 | Initiate datastep w/o creating a dataset | 
| 
 
 
 | Specify field length to read directory entries' names into | 
| 
 
 
 | |
| 
 
 
 | |
| 
 
 
 | |
| 
 
 
 | |
| 
 
 
 | |
| 
 
 
 | |
| 
 
 
 | |
| 
 
 
 | |
| 
 
 
 | END macro definition with name | 


