This example uses the CIMPORT
procedure to import multiple data sets from a transport file.
filename importin 'transport-file';
libname target 'SAS-data-library';
proc cimport infile=importin library=target memtype=data;
run;
In the preceding example, the fileref
IMPORTIN points to the location where the transport file was transferred
to the target computer. The libref TARGET points to a new location
where the transport file will be copied. The
PROC CIMPORT statement copies as its source the
file that is identified in the INFILE= option to the location identified
in the LIBRARY= option. The PROC CIMPORT statement implicitly translates
the transport file into the target computer native format.
Because
the LIBRARY= option permits both data sets and catalogs to be copied
to the library, you need to specify MEMTYPE=DATA to restrict the operation
to data sets in the library. Omitting the MEMTYPE= option permits
both data sets and catalogs, in the file referenced by the fileref
IMPORTIN, to be copied to the location referenced by the libref TARGET.
In order to subset the destination
member in PROC CIMPORT, use either the SELECT statement, the EXCLUDE
statement, or the MEMTYPE= option. Here is an example of subsetting:
filename importin 'transport-file';
libname target 'SAS-data-library';
proc cimport infile=importin library=target memtype=data;
select grades;
run;
In the preceding example,
the libref TARGET and the MEMTYPE= option point to the new location
where the transport file will be copied. The fileref IMPORTIN points
to the location where the transport file was transferred to the target
computer. The
PROC CIMPORT statement copies as its source the file that is identified in the
INFILE= option to the location identified in the LIBRARY= option.
The PROC CIMPORT statement implicitly translates the transport file
into the target computer native format.
The SELECT statement
selects only the data set GRADES for the library TARGET.