Type : EXTERNE
Die Daten stammen von einem Systembefehl (Pipe), der die Dateien des angegebenen Verzeichnisses auflistet.
| 1 | %macro dirfp2sas(filepattern,dsout); |
| 2 | |
| 3 | %local savopts; |
| 4 | %let savopts=%sysfunc(getoption(NOTES)); |
| 5 | |
| 6 | %IF not %LENGTH(&dsout) %THEN %let dsout=_dirfp2sas; |
| 7 | |
| 8 | options nonotes; |
| 9 | |
| 10 | filename _dirfp pipe |
| 11 | "echo off & for %nrstr(%f) in (""&filepattern"") do echo %nrstr(%f)"; |
| 1 | DATA &dsout; |
| 2 | LENGTH filename $ 300 lcfname $ 200; |
| 3 | INFILE _dirfp; |
| 4 | INPUT; |
| 5 | filename=trim(_infile_); |
| 6 | lcfname=lowcase(scan(filename,-1,"\")); |
| 7 | RUN; |
| 1 | filename _dirfp CLEAR; |
| 2 | |
| 3 | options &savopts; |
| 4 | |
| 5 | %mend dirfp2sas; |