Type : CREATION_INTERNE
Data is dynamically generated by executing a system command (ls) and read via a PIPE.
| 1 | %macro ls2sas(filepattern,dsout); |
| 2 | |
| 3 | %local savopts; |
| 4 | %let savopts=%sysfunc(getoption(NOTES)); |
| 5 | |
| 6 | %IF not %LENGTH(&dsout) %THEN %let dsout=_ls2sas; |
| 7 | |
| 8 | options nonotes; |
| 9 | |
| 10 | filename _ls2sas pipe "ls -1 %sysfunc(dequote(&filepattern))"; |
| 11 | |
| 12 | DATA &dsout; |
| 13 | LENGTH filename lcfname $ 200; |
| 14 | INFILE _ls2sas; |
| 15 | INPUT; |
| 16 | filename=trim(_infile_); |
| 17 | lcfname=lowcase(scan(filename,-1,"/")); |
| 18 | RUN; |
| 19 | |
| 20 | filename _ls2sas CLEAR; |
| 21 | |
| 22 | options &savopts; |
| 23 | |
| 24 | %mend ls2sas; |