I have a sas.xpt file , how to find the version of the xpt file. i tried proc contents but not much useful, is there any way we can find more information. Thanks for the help
If you have a file with .xpt as the file extension you still need to know what type of file it is. Whether is was created by PROC CPORT or is was created by the XPORT libref engine. Or perhaps the new %LOC2XPT() SAS supplied autocall macro.
Here is a macro you can use that will read the first few bytes of the file and tell you want type of file it is.
https://github.com/sasutils/macros/blob/master/xpttype.sas
/*----------------------------------------------------------------------------
Check file to see what type of transport file it is.
Returns
CPORT for PROC CPORT/CIMPORT file
XPORT for V5 export file
XPORT_V9 for V8/9 export file
SAS7BDAT for SAS dataset
UNKNOWN for any other file
Examples:
%put %xpttype('~/xport.xpt');
%put %xpttype('~/subj.xpt');
%put %xpttype('~/r_lrevw.xpt');
%put %xpttype('~/test1.sas7bdat');
----------------------------------------------------------------------------*/
The only version information I am aware of that might be in an XPT file would be the version of SAS that created the file. Is that what you are looking for?
If you have a file with .xpt as the file extension you still need to know what type of file it is. Whether is was created by PROC CPORT or is was created by the XPORT libref engine. Or perhaps the new %LOC2XPT() SAS supplied autocall macro.
Here is a macro you can use that will read the first few bytes of the file and tell you want type of file it is.
https://github.com/sasutils/macros/blob/master/xpttype.sas
/*----------------------------------------------------------------------------
Check file to see what type of transport file it is.
Returns
CPORT for PROC CPORT/CIMPORT file
XPORT for V5 export file
XPORT_V9 for V8/9 export file
SAS7BDAT for SAS dataset
UNKNOWN for any other file
Examples:
%put %xpttype('~/xport.xpt');
%put %xpttype('~/subj.xpt');
%put %xpttype('~/r_lrevw.xpt');
%put %xpttype('~/test1.sas7bdat');
----------------------------------------------------------------------------*/
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
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.