Examples: CIMPORT Procedure


Example 1: Importing an Entire Data Library

Procedure features:

  • PROC CIMPORT statement option:

    • INFILE=

This example shows how to use PROC CIMPORT to read from disk a transport file, named TRANFILE, that PROC CPORT created from a SAS data library in another operating environment. The transport file was moved to the new operating environment by means of communications software or magnetic medium. PROC CIMPORT imports the transport file to a SAS data library, called NEWLIB, in the new operating environment.

Program

Specify the library name and filename. The LIBNAME statement specifies a libname for the new SAS data library. The FILENAME statement specifies the filename of the transport file that PROC CPORT created and enables you to specify any operating environment options for file characteristics.

 libname newlib  SAS-data-library  ';  filename tranfile '  transport-file  '  host-option(s)-for-file-characteristics  ; 

Import the SAS data library in the NEWLIB library. PROC CIMPORT imports the SAS data library into the library named NEWLIB.

 proc cimport library=newlib infile=tranfile;  run; 

SAS Log

 NOTE: Proc CIMPORT begins to create/update catalog NEWLIB.FINANCE  NOTE: Entry LOAN.FRAME has been imported.  NOTE: Entry LOAN.HELP has been imported.  NOTE: Entry LOAN.KEYS has been imported.  NOTE: Entry LOAN.PMENU has been imported.  NOTE: Entry LOAN.SCL has been imported.  NOTE: Total number of entries processed in catalog NEWLIB.FINANCE: 5  NOTE: Proc CIMPORT begins to create/update catalog NEWLIB.FORMATS  NOTE: Entry REVENUE.FORMAT has been imported.  NOTE: Entry DEPT.FORMATC has been imported.  NOTE: Total number of entries processed in catalog NEWLIB.FORMATS: 2 

Example 2: Importing Individual Catalog Entries

Procedure features:

  • PROC CIMPORT statement options:

    • INFILE=

  • SELECT statement

This example shows how to use PROC CIMPORT to import the individual catalog entries LOAN.PMENU and LOAN.SCL from the transport file TRANS2, which was created from a single SAS catalog.

Program

Specify the library name, filename, and operating environment options. The LIBNAME statement specifies a libname for the new SAS data library. The FILENAME statement specifies the filename of the transport file that PROC CPORT created and enables you to specify any operating environment options for file characteristics.

 libname newlib '  SAS-data-library  ';  filename trans2 '  transport-file  '  host-option(s)-for-file-characteristics  ; 

Import the specified catalog entries to the new SAS catalog. PROC CIMPORT imports the individual catalog entries from the TRANS2 transport file and stores them in a new SAS catalog called NEWLIB.FINANCE. The SELECT statement selects only the two specified entries from the transport file to be imported into the new catalog.

 proc cimport catalog=newlib.finance infile=trans2;     select loan.pmenu loan.scl;  run; 

SAS Log

 NOTE: Proc CIMPORT begins to create/update catalog NEWLIB.FINANCE  NOTE: Entry LOAN.PMENU has been imported.  NOTE: Entry LOAN.SCL has been imported.  NOTE: Total number of entries processed in catalog NEWLIB.FINANCE: 2 

Example 3: Importing a Single Indexed SAS Data Set

Procedure features:

  • PROC CIMPORT statement option:

    • INFILE=

This example shows how to use PROC CIMPORT to import an indexed SAS data set from a transport file that was created by PROC CPORT from a single SAS data set.

Program

Specify the library name, filename, and operating environment options. The LIBNAME statement specifies a libname for the new SAS data library. The FILENAME statement specifies the filename of the transport file that PROC CPORT created and enables you to specify any operating environment options for file characteristics.

 libname newdata '  SAS-data-library  ';  filename trans3 '  transport-file  '  host-option(s)-for-file-characteristics  ; 

Import the SAS data set. PROC CIMPORT imports the single SAS data set that you identify with the DATA= specification in the PROC CIMPORT statement. PROC CPORT exported the data set NEWDATA.TIMES in the transport file TRANS3.

 proc cimport data=newdata.times infile=trans3;  run; 

SAS Log

 NOTE: Proc CIMPORT begins to create/update data set NEWDATA.TIMES  NOTE: The data set index x is defined.  NOTE: Data set contains 2 variables and 2 observations.        Logical record length is 16 



Base SAS 9.1.3 Procedures Guide (Vol. 1)
Base SAS 9.1 Procedures Guide, Volumes 1, 2, 3 and 4
ISBN: 1590472047
EAN: 2147483647
Year: 2004
Pages: 260

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net