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');
----------------------------------------------------------------------------*/
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.