Chapter Contents

Previous

Next
Moving and Accessing SAS Files across Operating Environments

Creating a Transport File for Member Type DATA

You can use any of these methods to create a transport file for member type DATA:


Using the DATA Step to Create a Transport File for One Data Set

This example uses the DATA step to create a transport file for a single data set.

libname source 'SAS-data-library';
libname xportout xport 'transport-file';
data xportout.grades;
   set source.grades;
run;

In the preceding example, the libref SOURCE points to the original location of the data set that is on the source host. The libref XPORTOUT points to a new location where the transport file will be created. The XPORT engine in this LIBNAME statement specifies that the data set is to be created in transport format. The SET statement reads the data set GRADES and re-creates it in transport format at the location specified in the DATA statement.


Using PROC COPY to Create a Transport File for One or More Data Sets

This example uses the COPY procedure to create a transport file for multiple data sets.

libname source 'SAS-data-library';
libname xportout xport 'transport-file';
proc copy in=source out=xportout memtype=data; 
run;

In the preceding example, the libref SOURCE points to the original location of the library that is on the source host. The libref XPORTOUT points to a new location to which the transport file will be copied. The XPORT engine in this LIBNAME statement specifies that the library is to be created in transport format. The PROC COPY statement copies all data sets in the library that are identified in the IN= option to the new library that is identified in the OUT= option. The MEMTYPE=DATA option limits the files that are copied to type DATA, which excludes catalogs and views.

CAUTION:
Do not omit the MEMTYPE=DATA option. Otherwise, SAS attempts to copy the entire contents of the library (including catalogs and views) to the transport file. The XPORT engine does not support the CATALOG or the VIEW member type. Error and warning messages are written to the SAS log.  [cautionend]

This example uses PROC COPY to create a transport file for one data set:

libname source 'SAS-data-library';
libname xportout xport 'transport-file';
proc copy in=source out=xportout memtype=data; 
   select grades;
run;

In the preceding example, the libref SOURCE points to the original location of the data set that is on the source host. The libref XPORTOUT points to a new location where the transport file will be copied. The XPORT engine in this LIBNAME statement specifies that the data set is to be created in transport format. The PROC COPY statement copies all data sets that are identified in the IN= option to the new library that is identified in the OUT= option. The MEMTYPE=DATA option limits the files that are copied to type DATA, which excludes catalogs and views. The SELECT statement specifies that only the data set GRADES be copied to the new library. You could specify more than one data set here. The omission of the SELECT statement would imply that all data sets be copied to the transport file.

Note:   You can use the EXCLUDE statement to omit explicitly the data sets that you do not want rather than the SELECT statement to specify the data sets that you want.  [cautionend]


Using PROC CPORT to Create a Transport File for One or More Data Sets

This example uses the CPORT procedure to create a transport file for one data set.

libname source 'SAS-data-library';
filename cportout 'transport-file';
proc cport data=source.grades file=cportout;
run;

In the preceding example, the libref SOURCE points to the original location of the data set that is on the source host. The fileref CPORTOUT points to a new location where the transport file will be created. The PROC CPORT statement copies as its source the file identified in the DATA= option to the new transport file identified in the FILE= option. The DATA= option specifies only one data set to be transported.

Specifying the LIBRARY= option instead of the DATA= option to PROC CPORT would expand the operation to include the entire contents of the library, which may contain multiple catalogs and data sets.

Here is an example of PROC CPORT that specifies all data sets in the library:

proc cport library=source file=cportout memtype=data;


Chapter Contents

Previous

Next

Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.