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;
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.