Tom's suggestion lead me to my problem, and I found the issue. Please see my last comment to see the exact error I was causing! As always, Thanks Tom Hello everyone. Can anyone help me understand what is going wrong with the following code? I don't know what I did incorrectly. note that the code inside the macro works (if instead of "&dsin" I simply replace it with "&inputfile" it works. It seems that taking inputfile and making it an entry into the macro call is causing my macro to no longer work, which does not make any sense to me. %let inputfile=i:\projects\mycsv.csv; %macro DatasetNames(dsin,dsout); data &dsout; infile "&dsin." dsd lrecl=32000 truncover obs=1; length varnumCSV 8 name $2000.; input @; do varnumCSV = 1 to countw(_infile_,',','Q'); input name @; output; end; run; %mend; %DatasetNames(&inputfile,outputdataset); In addition, the following code also works, it is a modifiation of the above. %let inputfile=i:\projects\mycsv.csv; %macro DatasetNames(dsin,dsout); data &dsout; infile dsin. dsd lrecl=32000 truncover obs=1; length varnumCSV 8 name $2000.; input @; do varnumCSV = 1 to countw(_infile_,',','Q'); input name @; output; end; run; %mend; %DatasetNames("&inputfile",outputdataset); So adding the quotes into the macro call instead of within the macro itself causes this to run. I don't understand why however. Thanks!
... View more