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;
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.