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 2025: Call for Content

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!

Submit your idea!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 660 views
  • 4 likes
  • 4 in conversation