Help using Base SAS procedures

Invalid SAS transport file, problem on second record

Accepted Solution Solved
Reply
New Contributor
Posts: 2
Accepted Solution

Invalid SAS transport file, problem on second record

I am generating single dataset transport files using the PROC CPORT method.  I have no error/warning messages in the conversion to transport files, and have no issues re-importing the datasets using PROC CIMPORT.  However, if I try to open the .xpt file using Universal Viewer then I get an error ("The file xxxxx could not be loaded, Invalid SAS transport file, problem on second record").


Can anyone please shed light on the cause of such an error.  I've even tried a really simple test dataset (one variable, one entry), and still get the error.

Here's the code I'm using to generate the transport files:

 

%macro export (data=);

filename &data "path......\&data..xpt";

proc cport data=ITP.&data file=&data;

run;

%mend export;

  

%export (data=ADR)

%export (data=COMPL)

%export (data=CONMEDS)

....................................


Thanks in advance!

Elisa


Accepted Solutions
Solution
‎01-07-2015 08:06 PM
New Contributor
Posts: 2

Re: Invalid SAS transport file, problem on second record

I did end up finding the solution.   Datasets created by PROC CPORT have to be read into SAS by using PROC CIMPORT.  You can name the  *.xpt, but it is not actually a v5 xpt format file.  SAS viewer can't open datasets created by PROC CPORT.  To create v5 xpt files you need to use XPORT engine.  An Example:

 

%macro v5export (data=);

libname &DATA xport "C:\&DATA..xpt";

    

proc copy in=ITP out=&DATA memtype=data;

     select &DATA;

run;

%mend v5export;

 

%v5export (data=ADR)

%v5export (data=COMPL)

%v5export (data=CONMEDS)

View solution in original post


All Replies
Contributor
Posts: 57

Re: Invalid SAS transport file, problem on second record

Hi everybody,

I have exacly the same problem. If anyone has an answer, it would be very helpful.

Best,

Solution
‎01-07-2015 08:06 PM
New Contributor
Posts: 2

Re: Invalid SAS transport file, problem on second record

I did end up finding the solution.   Datasets created by PROC CPORT have to be read into SAS by using PROC CIMPORT.  You can name the  *.xpt, but it is not actually a v5 xpt format file.  SAS viewer can't open datasets created by PROC CPORT.  To create v5 xpt files you need to use XPORT engine.  An Example:

 

%macro v5export (data=);

libname &DATA xport "C:\&DATA..xpt";

    

proc copy in=ITP out=&DATA memtype=data;

     select &DATA;

run;

%mend v5export;

 

%v5export (data=ADR)

%v5export (data=COMPL)

%v5export (data=CONMEDS)

Contributor
Posts: 57

Re: Invalid SAS transport file, problem on second record

Hi Elisa,

Thanks a lot for your answer which is of a great help!

Best regards,

🔒 This topic is solved and locked.

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

Discussion stats
  • 3 replies
  • 726 views
  • 2 likes
  • 2 in conversation