Chapter Contents |
Previous |
Next |
Using Version 8 to Access Data Files from Earlier Releases without Converting |
In general, you can use Version 8 to manipulate Version 6 data files, using the V6 compatibility engine as long as needed. However, you will not be able to maximize the potential of Version 8 until you convert Version 6 data files to Version 8 format.
Using Version 6 to Access Version 8 Data Files |
Version 6 cannot access a Version 8 data file due to differences in the file format, except with SAS/SHARE or SAS/CONNECT software.
Converting Version 6 Data Files to Version 8 Format |
Even though you can use Version 8 with Version 6 data files, in order to use Version 8 features such as long variable names, integrity constraints, and generation data sets, you must convert existing data to Version 8 format.
To convert a Version 6 data file to Version 8 format, you can use one of the following methods:
libname old v6 "v6-SAS-data-library"; libname new v8 "v8-SAS-data-library"; proc copy in=old out=new memtype=data; run;
This technique works well if you want to convert only one or two data files:
libname old v6 "v6-SAS-data-library"; libname new v8 "v8-SAS-data-library"; data new.data; set old.data; run;
/* Release 6.12 SAS program */ libname old "v6-SAS-data-library"; proc cport cat=old.mydat file='myxpt.xpt'; run;
The next program then uses PROC CIMPORT to convert the transport file to the Version 8 data file NEW.MYDAT:
/* Version 8 SAS program */ libname new "v8-SAS-data-library"; proc cimport cat=new.mydat file='myxpt.xpt'; run;
Note: Depending on your operating environment,
PROC CPORT and PROC CIMPORT may require different syntax. See the SAS documentation
for your operating environment.
Creating Version 6 Data Files in Version 8 |
You may need to create a Version 6 data file in a Version 8 session, for example, if you are sharing data with a Version 6 application. To do so, you use the V6 compatibility engine. For example, the following statements use the V6 engine to create a SAS data file named QTR1. The raw data is read from the external file associated with the fileref MYFILE:
libname newdata v6 "SAS-data-library"; filename myfile "external-file"; data newdata.qtr1; infile myfile; input saledata amount; run;
You may also need to create a Version 6 data file from a Version 8 data file. However, because the Version 8 file could contain features like long variable names that are not compatible with Version 6, you would need to remove Version 8 features. In Version 8, the COPY procedure can automatically truncate long variable names if you specify the VALIDVARNAME=V6 system option.
For example, assume that a Version 8 SAS data file named V8LIB.EMPLOYEE contains the variables LASTNAME, FIRSTNAME, and EMPLOYEEID. By issuing the following PROC COPY with the VALIDVARNAME=V6 system option, the resulting Version 6 SAS data file V6LIB.EMPLOYEE contains the variables LASTNAME, FIRSTNAM, and EMPLOYEE:
libname v8lib "v8-SAS-data-library"; libname v6lib "v6-SAS-data-library"; options validvarname=v6; proc copy in=v8lib out=v6lib; select=employee; run;
Chapter Contents |
Previous |
Next |
Top of Page |
Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.