BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Tom
Super User Tom
Super User

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.

Ksharp
Super User
Follow the @Tom suggestion . There is another macro can do this . Same as

filename xpt 'Z:\Databases\CDM\Exports\Production\20220408_Test\Export\Results\xyz.xpt';
libname sas v9 'Z:\Databases\CDM\Exports\Production\20220408_Test\Export\Input';

%xpt2loc(libref=sas,filespec=xpt)
A_Kh
Lapis Lazuli | Level 10

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;

 

Ksharp
Super User
filename xpt 'Z:\Databases\CDM\Exports\Production\20220408_Test\Export\Results\xyz.xpt';
libname sas v9 'Z:\Databases\CDM\Exports\Production\20220408_Test\Export\Input';

%loc2xpt(libref=sas,filespec=xpt)

SAS Innovate 2025: Register Now

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!

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 18 replies
  • 5452 views
  • 4 likes
  • 6 in conversation