Macro rXDIR (from Fraktal SAS Programming): Unterschied zwischen den Versionen
| KKeine Bearbeitungszusammenfassung | KKeine Bearbeitungszusammenfassung | ||
| Zeile 129: | Zeile 129: | ||
| </font>   | </font>   | ||
| | | | | ||
| Open data stream from file reference | |||
| |- | |- | ||
| | | | | ||
| Zeile 135: | Zeile 136: | ||
| </font>   | </font>   | ||
| | | | | ||
| Define tokens coming in of varying length with name ''entry'' | |||
| |- | |- | ||
| | | | | ||
| Zeile 141: | Zeile 143: | ||
| </font>   | </font>   | ||
| | | | | ||
| Instantly write ''entry'' to the LOG screen | |||
| |- | |- | ||
| | | | | ||
| Zeile 147: | Zeile 150: | ||
| </font>   | </font>   | ||
| | | | | ||
| Terminate the data step | |||
| |- | |- | ||
| | | | | ||
| Zeile 153: | Zeile 157: | ||
| </font>   | </font>   | ||
| | | | | ||
| Close data stream ''path'' | |||
| |- | |- | ||
| | | | | ||
| Zeile 159: | Zeile 164: | ||
| </font>   | </font>   | ||
| | | | | ||
| Recursively call macro ''rxdir'' with parameter ''rpath'' | |||
| |- | |- | ||
| | | | | ||
| Zeile 165: | Zeile 171: | ||
| </font>   | </font>   | ||
| | | | | ||
| Define GOTO label 'leave' | |||
| |- | |- | ||
| | | | | ||
| Zeile 171: | Zeile 178: | ||
| </font>   | </font>   | ||
| | | | | ||
| Empty macrovariable ''rpath'' | |||
| |- | |- | ||
| | | | | ||
Version vom 24. November 2014, 19:04 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 | 
| 
 
 
 | Open data stream from file reference | 
| 
 
 
 | Define tokens coming in of varying length with name entry | 
| 
 
 
 | Instantly write entry to the LOG screen | 
| 
 
 
 | Terminate the data step | 
| 
 
 
 | Close data stream path | 
| 
 
 
 | Recursively call macro rxdir with parameter rpath | 
| 
 
 
 | Define GOTO label 'leave' | 
| 
 
 
 | Empty macrovariable rpath | 
| 
 
 
 | END macro definition with name | 


