We can see from the output below that salary6 was successfully created and it is a SAS version 6.x file that can be read under SAS version 6.x.libname out v6 'c:\dissertation\'; data out.salary6; set 'c:\dissertation\salary8'; run; proc print data=out.salary6; run; proc contents data=out.salary6; run;
Obs SAL1996 SAL1997 SAL1998 SAL1999 SAL2000
1 10000 10500 11000 12000 12700
2 14000 16500 18000 22000 29000
The CONTENTS Procedure
Data Set Name: OUT.SALARY6 Observations: 2
Member Type: DATA Variables: 5
Engine: V6 Indexes: 0
Created: 16:53 Thursday, November 16, 2000 Observation Length: 40
Last Modified: 16:53 Thursday, November 16, 2000 Deleted Observations: 0
Protection: Compressed: NO
Data Set Type: Sorted: NO
Label:
-----Engine/Host Dependent Information-----
<output edited to save space>
File Name: c:\dissertation\salary6.sd2
Release Created: 6.08.00
Host Created: WIN
-----Alphabetic List of Variables and Attributes-----
# Variable Type Len Pos
-----------------------------------
1 SAL1996 Num 8 0
2 SAL1997 Num 8 8
3 SAL1998 Num 8 16
4 SAL1999 Num 8 24
5 SAL2000 Num 8 32
It is possible that your SAS version 8 file might have contained long variable names, a feature available in version 8 but not available in version 6. Say that you have a data file called c:\dissertation\salaryl.sas7bdat that contains long variable names. If we try to convert it the same way that we did in the example above, it does not work.
Running this we get the following error message in the log.data out.salary6; set 'c:\dissertation\salaryl'; run;
ERROR: The variable name Salary1996 is illegal for the version 6 file ;
OUT.SALARY6.DATA. ;
NOTE: The SAS System stopped processing this step because of errors. ;
In this case, we need to use the validvarname=v6 option to
tell SAS to use/create variable names that are compatible with
SAS version 6 and to use proc copy to copy the data file, as
illustrated in the example below.
As we can see from the output below, we were able to successfully convert the data file to a version 6 data file. SAS converted the long variable names into 8 character variable names. The conversion led to some variable names that were not very intuitive so be sure to inspect the proc contents. As you see below, the proc contents includes a variable label that shows the name of the variable before it was converted.options validvarname=v6; libname diss8 v8 'c:\dissertation\'; libname diss6 v6 'c:\dissertation\'; proc copy in=diss8 out=diss6 ; select salaryl; run; proc print data=diss6.salaryl; run; proc contents data=diss6.salaryl; run;
Obs SALARY19 SALARY12 SALARY13 SALARY14 SALARY20
1 10000 10500 11000 12000 12700
2 14000 16500 18000 22000 29000
The CONTENTS Procedure
Data Set Name: DISS6.SALARYL Observations: 2
Member Type: DATA Variables: 5
Engine: V6 Indexes: 0
Created: 16:53 Thursday, November 16, 2000 Observation Length: 40
Last Modified: 16:53 Thursday, November 16, 2000 Deleted Observations: 0
Protection: Compressed: NO
Data Set Type: Sorted: NO
Label:
-----Engine/Host Dependent Information-----
<output edited to save space>
File Name: c:\dissertation\salaryl.sd2
Release Created: 6.08.00
Host Created: WIN
-----Alphabetic List of Variables and Attributes-----
# Variable Type Len Pos Label
-------------------------------------------------
2 SALARY12 Num 8 8 Salary1997
3 SALARY13 Num 8 16 Salary1998
4 SALARY14 Num 8 24 Salary1999
1 SALARY19 Num 8 0 Salary1996
5 SALARY20 Num 8 32 Salary2000
The content of this web site should not be construed as an endorsement of any particular web site, book, or software product by the University of California.