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-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

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.

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