Sunday, December 15, 2013

Read SAS Transport file in .cpt or .dat format

READ .cpt file

* assign filename "in" to CPORT file "winners.cpt";
filename in "winners.cpt";

libname out '/work/';

* read from "winners.cpt" and save in library "out";
proc cimport file=in library=out;
run;

* use proc contents, proc print, and proc means to verify ;
*   that out.winners was created properly;
* change winners to the name of your data member;

proc contents data=out.winners;
run;

proc print data=out.winners(obs=10);
run;

proc means data=out.winners;
run;


READ .dat file

* Using PROC CPORT, you can create a transport file in .dat extension.  You can use the code below and modify to where you store the .dat file;  
 
libname outlib 'C:\TEMP';
filename infile 'TAL050003XF.dat';
proc cimport library=outlib file=infile;
run;

No comments:

Post a Comment