PROC CPORT and PROC CIMPORT

Below is a collection of Proc Cport and Cimport SAS® papers used to convert datasets and catalog files to transport files and back to be used across different operating systems. See also Data Access of External files. 



* Option for all datasets in one XPT file, SELECT statement for individual xpt and datasets;
libname indata xport 'Z:\Kite_Pharma\NCI-CD19\data\09C0082_14NOV2016.xpt';
libname library 'Z:\Kite_Pharma\NCI-CD19\data_nov2016';
proc copy in=indata out=library; run;



/* Create transport file from SAS dataset */
Filename tranfile ‘c:\temp\tran.xpt’; * Name of file to create;
Libname mydata ‘.’;

*Option 1;
Proc cport lib=mydata file=tranfile;
Select times; * dataset name;
Run;

*Option 2;
Proc cport data=mydata.times file=tranfile;
Run;


/* Restore SAS dataset from transport file */
* Option 1;
Filename tranfile ‘c:\temp\tran.xpt’;  * Name of file to restore;
Libname mydata ‘.’;

Proc cimport infile=tranfile lib=mydata;
Select times; * dataset name;
Run;

*Option 2;
Proc cimport infile=tranfile data=mydata.times;
Run; 

SAS® Reference Proc Cport SyntaxProc Cimport Syntax  

SAS Transport File Record Layout    Converting to/from SAS Transport Files

1. Tips and Techniques For Moving Between Operating Environments, J. Meimei Ma, and Sandra Schlotzhauer

2. Macro for Restoring SAS® Transport Files, Yefim Gershteyn [PROC COPY]

3. PROC COPY and PROC APPEND: A Developer’s Secrets, Diane Olson

4. Those pesky SAS v5 transport files, what’s inside?, John Adams

5. UNC SAS Transport Tips

6. SAS_TRAN: A SAS Macro for Generating SAS Transport Files, Taghi Garacani, Donald Peterson [Macro]

Powered by Wild Apricot Membership Software