Maps Online >Resources SAS logo
Feedback   

Sample Data
Sample Programs
Tools
Useful Links

/*******************************************************************\
| Copyright (C) 2002 by SAS Institute Inc., Cary, NC, USA.          |
|                                                                   |
| SAS (R) is a registered trademark of SAS Institute Inc.           |
|                                                                   |
| SAS Institute does not assume responsibility for the accuracy of  |
| any material presented in this file.                              |
\*******************************************************************/


/* Using the CIMPORT procedure to import SAS tables */

/********************************************************************
* Since the transport files are created by PROC CPORT, you need to *
* use PROC CIMPORT to process the transport file. You can import   *
* files to a release SAME as or HIGHER than the release used to    *
* create the transport file.                                       *
********************************************************************/

/********************************************************************
* Example 1:                                                       *
* PROC CIMPORT uses the file given in the INFILE= option as input  *
* and writes/unpacks/copies all data sets found in the transport   *
* file to the directory referenced by the libref SASFILES.         *
********************************************************************/

libname sasfiles 'c:\myfiles';
proc cimport infile='c:\mydownloads\zipcode.cpt' library=sasfiles;
run;


/********************************************************************
* Example 2:                                                       *
* In this example, we are reading the same transport file as in    *
* Example 1. However, we are using an alternate way of specifying  *
* the location of the transport file. A FILENAME statement assigns *
* a fileref or nickname to the transport file. We use the fileref  *
* or nickname in the INFILE= option of PROC CIMPORT.               *
********************************************************************/


libname sasfiles 'c:\myfiles';
filename intrans 'c:\mydownloads\zipcode.cpt' ;
proc cimport infile=intrans library=sasfiles;
run;

/********************************************************************
* NOTE from the Technical Support web site                   *
* Q: Does anybody know why when I use PROC CPORT/CIMPORT to move a*
*    data set from one operating system to another all the numeric *
*    variables with a length less than 8 increased by 1 byte in    *
*    length?                                                       *
********************************************************************
* A: Starting in Release 6.08, PROC CIMPORT has been enhanced with *
*    an EXTENDSN= option. By default, this option will cause short *
*    numeric variables to be extended in length to avoid a loss in *
*    precision.                                                    *
********************************************************************
*    For further information on issues relating to the CPORT and   *
*    CIMPORT procedures visit the SAS Technical Support web site>        *
********************************************************************/