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
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)
Hi everybody,
I have exacly the same problem. If anyone has an answer, it would be very helpful.
Best,
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)
Hi Elisa,
Thanks a lot for your answer which is of a great help!
Best regards,
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.