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";
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.