Dear,
I am using the below pgm to convert xpt files in a folder to sas datasets. The pgm is working fine. But i can only do one data set at a time. Please suggest me how to modify my pgm to convert all datasets. In the below pgm i am converting ae xpt file. What information i need to add in place of ae to work on all data sets.
libname tmp pipe "dir /b ""abc/ddd/%str(*).xpt""";
libname ms "abc/ddd";
data _null_;
infile tmp;
input;
call execute(cats('libname xptfile xport "abc/ddd/','ae','.xpt";'));
call execute('proc copy inlib=xptfile outlib=ms; run;');
call execute('filename xptfile clear;');
run;
Hmmm. Shouldn't the first Libname be a Filename?
Your code shouldn't need much in the way of a change if it's already working. You should just be able to change:
Jim
FILEname tmp pipe "dir /b ""abc/ddd/%str(*).xpt""";
libname ms "abc/ddd";
data _null_;
infile tmp TRUNCOVER;
input Dir_Listing $256.;
call execute(cats('libname xptfile xport "abc/ddd/', Dir_Listing, '";'));
call execute('proc copy inlib=xptfile outlib=ms; run;');
call execute('filename xptfile clear;');
run;
Also, I don't think you need %str(*)
FILEname tmp pipe "dir /b ""abc/ddd/*.xpt""";
or even simpler
FILEname tmp pipe "dir /b abc/ddd/*.xpt";
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.