Help using Base SAS procedures

problem of using macro to import multiple csv files

Reply
Contributor
Posts: 38

problem of using macro to import multiple csv files

Hi,

There are tens of csv files in folder D:\users\...\desktop\list. I need to import them into SAS.

For illustration purpose, I only take 2 files as the example.

%let country1=abudhabi;

%let country2=argentina;

%macro import;

%do i =1 % to 2;

proc import out = &&country&i

                 datafile="D:\users\...\desktop\list\&&country&i.csv"

                 dbms=csv replace;

run;

%end;;

%mend

import;

%import;

But the codes did not work and the error messages are as below:

*WARNING: Apparent symbolic reference D not resolved;

*WARNING: Apparent symbolic reference D not resolved;

*WARNING: Apparent symbolic reference COUNTRY1CSV not resolved;

*ERROR: Physical file does not exist,D:\Users\...\Desktop\list\&&country&i.csv;

*ERROR: Import unsuccessful. See SAS Log for details.;

Can anyone advise me what the problem is and how to resovle it? Thanks.

Ask a Question
Discussion stats
  • 0 replies
  • 122 views
  • 0 likes
  • 1 in conversation