I have the below code wherein it will work if path is hard coded but it's not working when macro variable is referenced (it says 0 records read). Please help me in getting the issue resolved. /** Working fine without macro variable **/
***************************************************************************************************
%let path1 = C:\work\test\final output;
filename DIRLIST pipe 'dir "C:\work\test\final output" /B';
data dirlist ;
length buffer $256 ;
infile dirlist length=reclen ;
input buffer $varying256. reclen ;
run ;
================================================================================================
/** Result **/
1684 %let path1 = C:\work\test\final output;
1685
1686 filename DIRLIST pipe 'dir "C:\work\test\final output" /B';
1687 data dirlist ;
1688
1689 length buffer $256 ;
1690
1691 infile dirlist length=reclen ;
1692
1693 input buffer $varying256. reclen ;
1694 run ;
NOTE: The infile DIRLIST is:
Unnamed Pipe Access Device,
PROCESS=dir "C:\work\test\final output" /B,
RECFM=V,LRECL=256
NOTE: 2 records were read from the infile DIRLIST.
The minimum record length was 3.
The maximum record length was 3.
NOTE: The data set WORK.DIRLIST has 2 observations and 1 variables.
NOTE: Compressing data set WORK.DIRLIST increased size by 100.00 percent.
Compressed is 2 pages; un-compressed would require 1 pages.
NOTE: DATA statement used (Total process time):
real time 0.03 seconds
cpu time 0.01 seconds
/** Not Working with macro variable **/
***************************************************************************************************
%let path1 = C:\work\test\final output;
filename DIRLIST pipe 'dir "&path1." /B';
data dirlist ;
length buffer $256 ;
infile dirlist length=reclen ;
input buffer $varying256. reclen ;
run ;
================================================================================================
/** Result **/
1695 %let path1 = C:\work\test\final output;
1696
1697 filename DIRLIST pipe 'dir "&path1." /B';
1698 data dirlist ;
1699
1700 length buffer $256 ;
1701
1702 infile dirlist length=reclen ;
1703
1704 input buffer $varying256. reclen ;
1705 run ;
NOTE: The infile DIRLIST is:
Unnamed Pipe Access Device,
PROCESS=dir "&path1." /B,RECFM=V,LRECL=256
Stderr output:
File Not Found
NOTE: 0 records were read from the infile DIRLIST.
NOTE: The data set WORK.DIRLIST has 0 observations and 1 variables.
NOTE: DATA statement used (Total process time):
real time 0.03 seconds
cpu time 0.03 seconds
... View more