System is on unix i need a directory listing and tried:
filename dirlist pipe 'dir "pathTOdirectory" ';
data nazwy;
length fname $256;
infile dirlist truncover length= reclen;
input fname $varying256. reclen;
run;
but i keep getting all filenames in one row and not in seperate, what i'm i doing wrong?
On UNIX systems, use the native ls instead of the DOS dir mockup:
filename dirlist pipe 'ls path ';
data nazwy;
length fname $256;
infile dirlist truncover length= reclen;
input fname $varying256. reclen;
run;
I always put a dlm= in the infile which can never happen in the returned information - you could probably look for CR/LF or other things:
filename dirlist pipe 'dir "pathTOdirectory" '; data nazwy; length fname $256; infile dirlist truncover length=reclen dlm="¬"; input fname $varying256. reclen; run;
Thus, as the delimter is never hit, then it only goes to a new line on cr/lf.
On UNIX systems, use the native ls instead of the DOS dir mockup:
filename dirlist pipe 'ls path ';
data nazwy;
length fname $256;
infile dirlist truncover length= reclen;
input fname $varying256. reclen;
run;
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and save with the early bird rate—just $795!
Need to connect to databases in SAS Viya? SAS’ David Ghan shows you two methods – via SAS/ACCESS LIBNAME and SAS Data Connector SASLIBS – in this video.
Find more tutorials on the SAS Users YouTube channel.