BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
SASuserlot
Barite | Level 11

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

1 ACCEPTED SOLUTION

Accepted Solutions
Tom
Super User Tom
Super User

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');

----------------------------------------------------------------------------*/

View solution in original post

4 REPLIES 4
ballardw
Super User

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?

Ksharp
Super User

I remembered @Tom    have already answered the question before.

 

Ksharp_0-1720578425935.png

 

Tom
Super User Tom
Super User

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');

----------------------------------------------------------------------------*/
SASuserlot
Barite | Level 11

Thank you @Tom @Ksharp @ballardw 

sas-innovate-wordmark-2025-midnight.png

Register Today!

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.


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
  • 4 replies
  • 1016 views
  • 4 likes
  • 4 in conversation