- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Posted 10-10-2020 06:36 PM
(2262 views)
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;
2 REPLIES 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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:
- Add the TRUNCOVER option to your INFILE.
- Add a variable name and informat to your INPUT statement
- Modify your CALL EXECUTE statement as shown below.
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;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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";
--
Paige Miller
Paige Miller