Files created by some other programs (dBase or Lotus 1-2-3, for example) can be used with SAS with some effort. SAS data sets can also be put into a form usable by these programs.
This discussion applies to SAS 6.08 release TS 407, or later, for the Microsoft Windows environment.
SAS can read a dBase or DIF file directly, or a dBase or DIF file can be turned into a SAS data set.
First, look at how SAS can read a dBase file directly.
These examples assume that mylib is a valid SAS libref.
Suppose the dBase file is c:\mydata.dbf. A SAS ``view descriptor''
called mydata is created as follows.
proc access dbms=dbf;
create mylib.mydata.access;
path=`c:\mydata.dbf';
create mylib.mydata.view;
select all;
run;
From this point on, the view descriptor mydata can be used as
though it were the name of a SAS data set in the catalog
mylib. It is not possible to add new variables to this data
set, however.
To put the data in a dBase file into a SAS data set, the procedure is slightly longer.
proc access dbms=dbf;
create mylib.mydata.access;
path=`c:\mydata.dbf';
create mylib.mydata.view;
select all;
proc access viewdesc=mylib.mydata out=mylib.mydata;
run;
This has created a SAS data set called mydata in the catalog
mylib which contains the variables in the dBase file. There
is no link between the dBase file and the SAS data set.
For DIF files, replace dbms=dbf with dbms=dif above. Filenames will
most likely have a .dif extension too.
To turn a SAS data set into a dBase (version 3) file, suppose the
SAS data set is mydata in the catalog mylib. Then
proc dbload dbms=dbf data=mylib.mydata;
path=`c:\mydata.dbf';
label;
limit=0;
load;
version=3;
run;
creates the dBase file c:\mydata.dbf. To make a DIF file
proc dbload dbms=dif data=mylib.mydata;
path=`c:\mydata.dif';
label;
limit=0;
load;
run;
does the job.
For more information, see the online help under SAS SYSTEM HELP--DATA MANAGEMENT--SAS/ACCESS or the SAS/ACCESS Manual.
Copyright © 1997 by Jerry Alan Veeh. All rights reserved.