03-11-2014 11:13 PM
I wrote the code below to import a number of data file to SAS.
However, it doesn't work. I think it is because of the path.
I am not sure how to fix it.
Could you please help me with that?
Many thanks as always.
%macro importdata (X=);
infile 'D:\data\&X.csv' firstobs=3
input date time .....;
03-11-2014 11:19 PM
infile 'D:\data\&X..csv' firstobs=3
two dots(.) instead of one. first dot (.) to make the macro variable boundary, the second dot(.) is the normal dot in file names.
03-11-2014 11:42 PM
Thank you, Haikuo.
Somehow it still doesn't work.
The notice is: ERROR: Physical file does not exist, D:\data\&X..csv.
(when I replace &X with data1. it runs)
Can you guess what did I do wrong?
03-12-2014 02:38 AM
To expand on Arthur's answer:
Single quotes explicitly prevent the macro engine from interpreting anything that they enclose.
Only strings in double quotes allow the macro engine to go to work.
03-12-2014 12:53 PM
It's a pleasure!
Just don't forget to mark the question as answered.
Need further help from the community? Please ask a new question.