Hi All,
I need to convert multiple SAS datasets in one folder to multiple xpt files in another folder.I have used cport but the i dont want to write for each individual dataset.
Request your inputs.
Thanks
Hi,
%let your_libname=put your libname here;
data _null_;
set sashelp.vtable (where=(LIBNAME="&YOUR_LIBNAME.")); /* Get all dataset names in that library */
call execute('filename tranfile "put your path to here\'||strip(memname)||'.xpt"; /* Update with your path to */
proc cport data=&YOUR_LIBNAME..'||strip(memname)||' file=tranfile; /* Cport each file to tranfile */
run;');
run;
Hi,
%let your_libname=put your libname here;
data _null_;
set sashelp.vtable (where=(LIBNAME="&YOUR_LIBNAME.")); /* Get all dataset names in that library */
call execute('filename tranfile "put your path to here\'||strip(memname)||'.xpt"; /* Update with your path to */
proc cport data=&YOUR_LIBNAME..'||strip(memname)||' file=tranfile; /* Cport each file to tranfile */
run;');
run;
hi RW9,
I tried running your code but its not generating xpt. It is not also giving any error or warning.
I get note : Just 0 obs read from vtable
Thanks,
Ruchita
Then your putting something wrong in the YOUR_LIBNAME, you need to put a working library which has datasets within it, for example if I wanted sashelp then: % let your_libname=sashelp;
Its where your datasets are.
Thanks RW9 !! got it .. I am getting the output .. Thanks a lot
Can you pls explain how to do vice versa .I want to convert multiple xpt files into datasets.I am trying to do using xport but no luck.Thanks in advance
libname xylib xport "/home/pbe0/yz142/data/sdtmxpt/*.xpt ";
proc copy in=xylib out=work;
run;
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.