DATA Step, Macro, Functions and more

XPT: Not a SAS data set

Accepted Solution Solved
Reply
Frequent Contributor
Posts: 82
Accepted Solution

XPT: Not a SAS data set

Can anyone explain this issue?

 

558 libname sas "D:\sastemp\_TD25684_PGHSAS1_" ;

NOTE: Libref SAS refers to the same physical library as WORK.

NOTE: Libref SAS was successfully assigned as follows:

Engine: V9

Physical Name: D:\sastemp\_TD25684_PGHSAS1_

559

560 libname xpt xport "M:\3 - SDTM\Exports_04142017\AE.xpt" ;

NOTE: Libref XPT was successfully assigned as follows:

Engine: XPORT

Physical Name: M:\3 - SDTM\Exports_04142017\AE.xpt

561

562 proc copy in = xpt out = sas memtype = data ;

563 select AE ;

564 run ;

NOTE: Input library XPT is sequential.

ERROR: File XPT.ALL. is not a SAS data set.

NOTE: Statements not processed because of errors noted above.

NOTE: PROCEDURE COPY used (Total process time):

real time 0.00 seconds

cpu time 0.00 seconds

NOTE: The SAS System stopped processing this step because of errors.

 

 

Note the transport file is named AE.XPT.  The only hint that I am getting from the user is the she exported from Omnicomm and set the version to V8.

 

Thank you,

 

Kevin


Accepted Solutions
Solution
‎04-18-2017 06:47 PM
Super User
Super User
Posts: 6,502

Re: XPT: Not a SAS data set

Looks like they made the XPT file using the %LOC2XPT() macro instead of using the XPORT libname engine.

So you need to use the %XPT2LOC() macro to convert it back into a dataset.

%*-------------------------------------------------------------------*;
%* The xpt2loc macro is used to convert a transport file into local  *;
%* SAS data set representation. The parameters are:                  *;
%*                                                                   *;
%* libref=          indicates the libref where the members will be   *;
%*                  written. The default is WORK.                    *;
%* memlist=         indicates the list of members in the library     *;
%*                  that are to be converted. The default is that    *;
%*                  all members will be converted.                   *;
%* filespec=        gives a fileref (unquoted) or a file path        *;
%*                  (quoted) where the transport file resides        *;
%*                  written. There is no default.                    *;
%*                                                                   *;
%* This macro should be able to handle V5 transport files written by *;
%* the XPORT engine. It should also handle V8 extended transport     *;
%* files written by the companion loc2xpt macro.                     *;
%*-------------------------------------------------------------------*;

So try something like this:

%xpt2loc(filespec="M:\3 - SDTM\Exports_04142017\AE.xpt") ;

View solution in original post


All Replies
Super User
Super User
Posts: 6,502

Re: XPT: Not a SAS data set

Check the file.  There are two types of transport files. The SAS V5 transport files that the XPORT libname engine can read. There are also files generated by PROC CPORT that you need to read using PROC CIMPORT.  If you look at the first line of the file you can see the difference.

XPORT files will look like

RULE:     ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+---
1         HEADER RECORD*******LIBRARY HEADER RECORD!!!!!!!000000000000000000000000000000

CPORT files will look like

RULE:     ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+---
1         **COMPRESSED** **COMPRESSED** **COMPRESSED** **COMPRESSED** **COMPRESSED********

Also note that if you have moved the files using FTP and FTP teated them as text files instead of binary files they can become corrupted.

Frequent Contributor
Posts: 82

Re: XPT: Not a SAS data set

HEADER RECORD*******LIBV8   HEADER RECORD!!!!!!!000000000000000000000000000000  SAS     SAS     SASLIB  9.1     WIN

 

HEADER RECORD*******LIBRARY HEADER RECORD!!!!!!!000000000000000000000000000000  SAS     SAS     SASLIB  9.4     X64_S08R

 

The top line is from the culprit XPT file.  The bottom is from our usual version.

 

Thank you,

 

Kevin

Frequent Contributor
Posts: 82

Re: XPT: Not a SAS data set

http://support.sas.com/kb/46/944.html

 

The XPORT engine is restricted to reading the older V5 transport files. Revisions to XPT2LOC.SAS and XPTCOMMN.SAS macros in this Download tab, and in releases after SAS 9.4ts1m3 within the autocall library, allow V5/V6 transport files created with %LOC2XPT to be converted using PROC COPY and the XPORT engine. However, if you try to read a V8/V9 transport file using PROC COPY and the XPORT engine, you will get an error in the log. The macro XPT2LOC reads both the older V5 transport files and the new V8/V9 transport file format.

Frequent Contributor
Posts: 82

Re: XPT: Not a SAS data set

1818  %xpt2loc
1819     ( libref   = work
1820     , memlist  = _all_
1821     , filespec = 'M:\Data Management\3 - SDTM\Exports_04142017\ae.xpt'
1822     ) ;

 

<SNIPPED>

 

NOTE: UNBUFFERED is the default with RECFM=N.
NOTE: The infile 'M:\Data Management\\3 - SDTM\Exports_04142017\ae.xpt' is:
      Filename=M:\Data Management\\3 - SDTM\Exports_04142017\ae.xpt,
      RECFM=N,LRECL=32767,File Size (bytes)=18400,
      Last Modified=14Apr2017:13:29:20,
      Create Time=14Apr2017:13:34:02

NOTE: Unexpected end of file for binary input.
NOTE: The data set WORK.AE has 3 observations and 41 variables.
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.01 seconds


NOTE: Fileref SASCODE has been deassigned.

Super User
Super User
Posts: 6,502

Re: XPT: Not a SAS data set

[ Edited ]

Sounds like you have a corrupt file.  The problem is that auto transfer modes can get confused becuase the beginning of the file looks like normal ASCII text, but the format is BINARY and should be transferred as such.

 

Solution
‎04-18-2017 06:47 PM
Super User
Super User
Posts: 6,502

Re: XPT: Not a SAS data set

Looks like they made the XPT file using the %LOC2XPT() macro instead of using the XPORT libname engine.

So you need to use the %XPT2LOC() macro to convert it back into a dataset.

%*-------------------------------------------------------------------*;
%* The xpt2loc macro is used to convert a transport file into local  *;
%* SAS data set representation. The parameters are:                  *;
%*                                                                   *;
%* libref=          indicates the libref where the members will be   *;
%*                  written. The default is WORK.                    *;
%* memlist=         indicates the list of members in the library     *;
%*                  that are to be converted. The default is that    *;
%*                  all members will be converted.                   *;
%* filespec=        gives a fileref (unquoted) or a file path        *;
%*                  (quoted) where the transport file resides        *;
%*                  written. There is no default.                    *;
%*                                                                   *;
%* This macro should be able to handle V5 transport files written by *;
%* the XPORT engine. It should also handle V8 extended transport     *;
%* files written by the companion loc2xpt macro.                     *;
%*-------------------------------------------------------------------*;

So try something like this:

%xpt2loc(filespec="M:\3 - SDTM\Exports_04142017\AE.xpt") ;
Frequent Contributor
Posts: 82

Re: XPT: Not a SAS data set

Tom,

 

  That is correct.  Sorry if I double posted.  I now have a working solution for the future.

 

 

Thank you,

 

Kevin

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 7 replies
  • 161 views
  • 0 likes
  • 2 in conversation