Macro XAMINE (from Fraktal SAS Programming): Unterschied zwischen den Versionen
		
		
		
		Zur Navigation springen
		Zur Suche springen
		
| KKeine Bearbeitungszusammenfassung | KKeine Bearbeitungszusammenfassung | ||
| Zeile 14: | Zeile 14: | ||
| |- | |- | ||
| | | | | ||
| <font face="Courier New">  | |||
| ;%MACRO xamine(xpath,etype); | ;%MACRO xamine(xpath,etype); | ||
| </font>  | |||
| | | | | ||
| |- | |- | ||
| | | | | ||
| <font face="Courier New">  | |||
| :%GLOBAL ne ie dir; | :%GLOBAL ne ie dir; | ||
| </font>  | |||
| | | | | ||
| |- | |- | ||
| | | | | ||
| <font face="Courier New">  | |||
| :%LOCAL xpath xentry entry etype; | :%LOCAL xpath xentry entry etype; | ||
| </font>  | |||
| | | | | ||
| |- | |- | ||
| | | | | ||
| <font face="Courier New">  | |||
| ;filename entries pipe "dir /b &XPATH." lrecl = 256; | ;filename entries pipe "dir /b &XPATH." lrecl = 256; | ||
| </font>  | |||
| | | | | ||
| |- | |- | ||
| | | | | ||
| <font face="Courier New">  | |||
| ;filename dirs pipe "dir /b /ad &XPATH." lrecl = 256;   | ;filename dirs pipe "dir /b /ad &XPATH." lrecl = 256;   | ||
| </font>  | |||
| | | | | ||
| |- | |- | ||
| | | | | ||
| <font face="Courier New">  | |||
| ;data entries; | ;data entries; | ||
| </font>  | |||
| | | | | ||
| |- | |- | ||
| | | | | ||
| <font face="Courier New">  | |||
| :length entry $256; | :length entry $256; | ||
| </font>  | |||
| | | | | ||
| |- | |- | ||
| | | | | ||
| <font face="Courier New">  | |||
| :infile entries length = lrecl end = EOF; | :infile entries length = lrecl end = EOF; | ||
| </font>  | |||
| | | | | ||
| |- | |- | ||
| | | | | ||
| <font face="Courier New">  | |||
| :input entry $varying256. lrecl; | :input entry $varying256. lrecl; | ||
| </font>  | |||
| | | | | ||
| |- | |- | ||
| | | | | ||
| <font face="Courier New">  | |||
| :if EOF then call symput('ne',trim(left(put(_N_,8.)))); | :if EOF then call symput('ne',trim(left(put(_N_,8.)))); | ||
| </font>  | |||
| | | | | ||
| |- | |- | ||
| | | | | ||
| <font face="Courier New">  | |||
| ;run; | ;run; | ||
| </font>  | |||
| | | | | ||
| |- | |- | ||
| | | | | ||
| <font face="Courier New">  | |||
| ;data dirs; | ;data dirs; | ||
| </font>  | |||
| | | | | ||
| |- | |- | ||
| | | | | ||
| <font face="Courier New">  | |||
| :length dir $256; | :length dir $256; | ||
| </font>  | |||
| | | | | ||
| |- | |- | ||
| | | | | ||
| <font face="Courier New">  | |||
| :infile dirs length = lrecl end = EOF; | :infile dirs length = lrecl end = EOF; | ||
| </font>  | |||
| | | | | ||
| |- | |- | ||
| | | | | ||
| <font face="Courier New">  | |||
| :input dir $varying256. lrecl; | :input dir $varying256. lrecl; | ||
| </font>  | |||
| | | | | ||
| |- | |- | ||
| | | | | ||
| <font face="Courier New">  | |||
| ;run; | ;run; | ||
| </font>  | |||
| | | | | ||
| |- | |- | ||
| | | | | ||
| <font face="Courier New">  | |||
| ;%DO ie = 1 %TO &NE.; | ;%DO ie = 1 %TO &NE.; | ||
| </font>  | |||
| | | | | ||
| |- | |- | ||
| | | | | ||
| <font face="Courier New">  | |||
| ;data _NULL_; | ;data _NULL_; | ||
| </font>  | |||
| | | | | ||
| |- | |- | ||
| | | | | ||
| <font face="Courier New">  | |||
| :set entries(firstobs = &IE. obs = &IE.); | :set entries(firstobs = &IE. obs = &IE.); | ||
| </font>  | |||
| | | | | ||
| |- | |- | ||
| | | | | ||
| <font face="Courier New">  | |||
| :call symput('entry',compress(translate(entry,'_','(-)'))); | :call symput('entry',compress(translate(entry,'_','(-)'))); | ||
| </font>  | |||
| | | | | ||
| |- | |- | ||
| | | | | ||
| <font face="Courier New">  | |||
| :call symput('xentry',trim(left(entry))); | :call symput('xentry',trim(left(entry))); | ||
| </font>  | |||
| | | | | ||
| |- | |- | ||
| | | | | ||
| <font face="Courier New">  | |||
| ;run; | ;run; | ||
| </font>  | |||
| | | | | ||
| |- | |- | ||
| | | | | ||
| <font face="Courier New">  | |||
| :%PUT |; | :%PUT |; | ||
| </font>  | |||
| | | | | ||
| |- | |- | ||
| | | | | ||
| <font face="Courier New">  | |||
| :%PUT &XPATH.&XENTRY.; | :%PUT &XPATH.&XENTRY.; | ||
| </font>  | |||
| | | | | ||
| |- | |- | ||
| | | | | ||
| <font face="Courier New">  | |||
| :%LET dir =; | :%LET dir =; | ||
| </font>  | |||
| | | | | ||
| |- | |- | ||
| | | | | ||
| <font face="Courier New">  | |||
| ;data _NULL_; | ;data _NULL_; | ||
| </font>  | |||
| | | | | ||
| |- | |- | ||
| | | | | ||
| <font face="Courier New">  | |||
| : set dirs(where = (dir = "&XENTRY.")) end = EOF; | : set dirs(where = (dir = "&XENTRY.")) end = EOF; | ||
| </font>  | |||
| | | | | ||
| |- | |- | ||
| | | | | ||
| <font face="Courier New">  | |||
| :if EOF then call symput('dir',trim(left(put(_N_,8.)))); | :if EOF then call symput('dir',trim(left(put(_N_,8.)))); | ||
| </font>  | |||
| | | | | ||
| |- | |- | ||
| | | | | ||
| <font face="Courier New">  | |||
| ;run; | ;run; | ||
| </font>  | |||
| | | | | ||
| |- | |- | ||
| | | | | ||
| <font face="Courier New">  | |||
| ;%IF &DIR. = 1 %THEN %DO; | ;%IF &DIR. = 1 %THEN %DO; | ||
| </font>  | |||
| | | | | ||
| |- | |- | ||
| | | | | ||
| <font face="Courier New">  | |||
| :%PUT +----; | :%PUT +----; | ||
| </font>  | |||
| | | | | ||
| |- | |- | ||
| | | | | ||
| <font face="Courier New">  | |||
| :%XDIR(&XPATH.&XENTRY.); | :%XDIR(&XPATH.&XENTRY.); | ||
| </font>  | |||
| | | | | ||
| |- | |- | ||
| | | | | ||
| <font face="Courier New">  | |||
| :%PUT +----; | :%PUT +----; | ||
| </font>  | |||
| | | | | ||
| |- | |- | ||
| | | | | ||
| <font face="Courier New">  | |||
| ;%END; | ;%END; | ||
| </font>  | |||
| | | | | ||
| |- | |- | ||
| | | | | ||
| <font face="Courier New">  | |||
| ;%ELSE %DO; | ;%ELSE %DO; | ||
| </font>  | |||
| | | | | ||
| |- | |- | ||
| | | | | ||
| <font face="Courier New">  | |||
| ;%IF %LENGTH(&ETYPE.) ne 0 %THEN %DO; | ;%IF %LENGTH(&ETYPE.) ne 0 %THEN %DO; | ||
| </font>  | |||
| | | | | ||
| |- | |- | ||
| | | | | ||
| <font face="Courier New">  | |||
| ;%IF %INDEX(%SCAN(&ETYPE.,2,_),%SCAN(&XENTRY,2,.)) != 0 %THEN %DO; | ;%IF %INDEX(%SCAN(&ETYPE.,2,_),%SCAN(&XENTRY,2,.)) != 0 %THEN %DO; | ||
| </font>  | |||
| | | | | ||
| |- | |- | ||
| | | | | ||
| <font face="Courier New">  | |||
| :%GLOBAL windir; | :%GLOBAL windir; | ||
| </font>  | |||
| | | | | ||
| |- | |- | ||
| | | | | ||
| <font face="Courier New">  | |||
| :%XSET(windir); | :%XSET(windir); | ||
| </font>  | |||
| | | | | ||
| |- | |- | ||
| | | | | ||
| <font face="Courier New">  | |||
| :%PUT +----; | :%PUT +----; | ||
| </font>  | |||
| | | | | ||
| |- | |- | ||
| | | | | ||
| <font face="Courier New">  | |||
| :%PUT | File &XENTRY. opened in external editor WordPad.; | :%PUT | File &XENTRY. opened in external editor WordPad.; | ||
| </font>  | |||
| | | | | ||
| |- | |- | ||
| | | | | ||
| <font face="Courier New">  | |||
| :SYSTASK command "&WINDIR.\write.exe ""&XPATH.\&XENTRY."""; | :SYSTASK command "&WINDIR.\write.exe ""&XPATH.\&XENTRY."""; | ||
| </font>  | |||
| | | | | ||
| |- | |- | ||
| | | | | ||
| <font face="Courier New">  | |||
| :%PUT +----; | :%PUT +----; | ||
| </font>  | |||
| | | | | ||
| |- | |- | ||
| | | | | ||
| <font face="Courier New">  | |||
| ;%END; | ;%END; | ||
| </font>  | |||
| | | | | ||
| |- | |- | ||
| | | | | ||
| <font face="Courier New">  | |||
| ;%IF %INDEX(%SCAN(&ETYPE.,1,_),%SCAN(&XENTRY,2,.)) != 0 %THEN %DO; | ;%IF %INDEX(%SCAN(&ETYPE.,1,_),%SCAN(&XENTRY,2,.)) != 0 %THEN %DO; | ||
| </font>  | |||
| | | | | ||
| |- | |- | ||
| | | | | ||
| <font face="Courier New">  | |||
| :%PUT +----; | :%PUT +----; | ||
| </font>  | |||
| | | | | ||
| |- | |- | ||
| | | | | ||
| <font face="Courier New">  | |||
| :%PUT | File &XENTRY. opened in SAS program editor window.; | :%PUT | File &XENTRY. opened in SAS program editor window.; | ||
| </font>  | |||
| | | | | ||
| |- | |- | ||
| | | | | ||
| <font face="Courier New">  | |||
| :%XEDIT(&XENTRY.,&XPATH.); | :%XEDIT(&XENTRY.,&XPATH.); | ||
| </font>  | |||
| | | | | ||
| |- | |- | ||
| | | | | ||
| <font face="Courier New">  | |||
| :%PUT +----; | :%PUT +----; | ||
| </font>  | |||
| | | | | ||
| |- | |- | ||
| | | | | ||
| <font face="Courier New">  | |||
| ;%END; | ;%END; | ||
| </font>  | |||
| | | | | ||
| |- | |- | ||
| | | | | ||
| <font face="Courier New">  | |||
| ;%END; | ;%END; | ||
| </font>  | |||
| | | | | ||
| |- | |- | ||
| | | | | ||
| <font face="Courier New">  | |||
| ;%END; | ;%END; | ||
| </font>  | |||
| | | | | ||
| |- | |- | ||
| | | | | ||
| <font face="Courier New">  | |||
| ;%END; | ;%END; | ||
| </font>  | |||
| | | | | ||
| |- | |- | ||
| | | | | ||
| <font face="Courier New">  | |||
| ;proc sql; | ;proc sql; | ||
| </font>  | |||
| | | | | ||
| |- | |- | ||
| | | | | ||
| <font face="Courier New">  | |||
| :drop table dirs; | :drop table dirs; | ||
| </font>  | |||
| | | | | ||
| |- | |- | ||
| | | | | ||
| <font face="Courier New">  | |||
| :drop table entries; | :drop table entries; | ||
| </font>  | |||
| | | | | ||
| |- | |- | ||
| | | | | ||
| <font face="Courier New">  | |||
| ;quit; | ;quit; | ||
| </font>  | |||
| | | | | ||
| |- | |- | ||
| | | | | ||
| <font face="Courier New">  | |||
| ;filename entries clear; | ;filename entries clear; | ||
| </font>  | |||
| | | | | ||
| |- | |- | ||
| | | | | ||
| <font face="Courier New">  | |||
| ;filename dirs clear; | ;filename dirs clear; | ||
| </font>  | |||
| | | | | ||
| |- | |- | ||
| | | | | ||
| <font face="Courier New">  | |||
| ;%MEND xamine; | ;%MEND xamine; | ||
| </font>  | |||
| | | | | ||
| |} | |} | ||
Version vom 4. September 2014, 16:38 Uhr
| Code executed | Function performed | 
|---|---|
| 
 
 
 | |
| 
 
 
 | |
| 
 
 
 | |
| 
 
 
 | |
| 
 
 
 | |
| 
 
 
 | |
| 
 
 
 | |
| 
 
 
 | |
| 
 
 
 | |
| 
 
 
 | |
| 
 
 
 | |
| 
 
 
 | |
| 
 
 
 | |
| 
 
 
 | |
| 
 
 
 | |
| 
 
 
 | |
| 
 
 
 | |
| 
 
 
 | |
| 
 
 
 | |
| 
 
 
 | |
| 
 
 
 | |
| 
 
 
 | |
| 
 
 
 | |
| 
 
 
 | |
| 
 
 
 | |
| 
 
 
 | |
| 
 
 
 | |
| 
 
 
 | |
| 
 
 
 | |
| 
 
 
 | |
| 
 
 
 | |
| 
 
 
 | |
| 
 
 
 | |
| 
 
 
 | |
| 
 
 
 | |
| 
 
 
 | |
| 
 
 
 | |
| 
 
 
 | |
| 
 
 
 | |
| 
 
 
 | |
| 
 
 
 | |
| 
 
 
 | |
| 
 
 
 | |
| 
 
 
 | |
| 
 
 
 | |
| 
 
 
 | |
| 
 
 
 | |
| 
 
 
 | |
| 
 
 
 | |
| 
 
 
 | |
| 
 
 
 | |
| 
 
 
 | |
| 
 
 
 | |
| 
 
 
 | |
| 
 
 
 | |
| 
 
 
 | |
| 
 
 
 | |
| 
 
 
 | |
| 
 
 
 | |
| 
 
 
 | 


