Chapter Contents

Previous

Next

Accessing SAS Data Files


Using Version 8 to Access Data Files from Earlier Releases without Converting

A Version 8 SAS session can read and update a Version 6 data file or a Version 7 data file without converting the file as long as the features included in the data file are supported by the file format's version. That is, you cannot use Version 8 features for a Version 6 data file.

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:


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.