BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Elisa
Calcite | Level 5

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

1 ACCEPTED SOLUTION

Accepted Solutions
Elisa
Calcite | Level 5

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

3 REPLIES 3
AnalytX
Fluorite | Level 6

Hi everybody,

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

Best,

Elisa
Calcite | Level 5

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)

AnalytX
Fluorite | Level 6

Hi Elisa,

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

Best regards,

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 3 replies
  • 3174 views
  • 2 likes
  • 2 in conversation