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:\Pharma\NCI-CD19\data\09C0082_14NOV2016.xpt';
libname library 'Z:\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;
Libname mydata '/home/sunil1/project';
LIBNAME xpt XPORT '/home/sunil1/project/vs.xpt';
PROC COPY IN=xpt OUT=mydata;
RUN;
* Option 2;
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 3;
Proc cimport infile=tranfile data=mydata.times;
Run;
SAS® Reference Proc Cport Syntax, Proc 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
6. SAS_TRAN: A SAS Macro for Generating SAS Transport Files, Taghi Garacani, Donald Peterson [Macro]
7. This is the Modern World: Simple, Overlooked SAS® Enhancements, Bruce Gilsen [Proc Copy]
8. The Nitty-Gritty of FDA Electronic Submission: A Programmer’s Perspective, Sandeep N Beniwal