SAS created two complementary macros for dealing with the extended xport format files. %XPT2LOC() and %LOC2XPT().
https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/movefile/p1x39mw5fqqnyln1a08o7tomv47e.htm
The both support copying multiple datasets into/out of a single transport file. Just leave off the optional MEMLIST parameter and it will copy all members from the libref into the transport file. Or all members from the transport file to the libref.
PS Be careful with empty datasets as there was (still is?) a bug in %XPT2LOC() where it was unable to notice when an empty file ended which caused it to read the information about the next file as data for the file that should have had zero observations.
Hi @Ksharp,
Thank you for sharing the information. I couldn't create .xpt using the V8 version due to syntax issiues. I use the server SAS, not installed in my laptop c disk.
Would you please give me the syntax for converting following dataset into .xpt using V8 xport engine?
dataset= "xyz.7bdat" need to be converted "xyz.xpt"
input_folder = "Z:\Databases\CDM\Exports\Production\20220408_Test\Export\Input"
output_folder = "Z:\Databases\CDM\Exports\Production\20220408_Test\Export\Results"
Used the below syntax which did not work.
FILENAME xpt "&output\xyz.xpt"; *output path and output file name; LIBNAME SAS V9 "c:\temp\SAS"; %loc2xpt(libref=sas,filespec=xpt); PROC COPY IN=result OUT=XPT; *result= Input_folder; SELECTxyz/MEMTYPE=DATA; RUN;
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.