|
|
|
|
DOS (disk operating system) commands can be used in a SAS program to create directories. This can be used to your advantage to expedite processing. The commands begin with a KEYWORD X, and have the DOS commands in quotation marks. For example, we create a sub-directory with lec10p2.sas.
When running a DOS command from SAS, type EXIT to continue running the SAS program.
Examples
A common format for data is the ASCII format. This format can be created by a variety of software, including editors, wordprocessors, spreadsheets, and database programs. ASCII files are often called "FLAT" files since they contain no formatting characters. The suffix *.DTA , *.DAT, or *.TXT are commonly used to denote ASCII data files. (Note that *.DTA is also used for STATA system data sets, so should be avoided.)
Locating the ASCII data file. There are two ways that the SAS program can locate the data. The two ways are:
What are Engines?
SAS data sets are stored in a special format. Only software that can recognize the special format can read SAS data files. There are two principal types of SAS data sets for PC's. The first type is created by SAS for DOS using SAS version 6.03 or 6.04 and is characterized by files that have the suffix *.ssd. The second type is created by SAS for Windows using Windows-SAS Version 6.08 (or later) and is characterized by files that have the suffix *.sd2. The manner in which data are stored differs between the two types. As a result, the type of SAS data set has to be specified when reading a SAS data set.
The manner in which SAS data sets are stored in Windows-SAS differs from that in SAS for DOS. The data sets saved using the SAS version 6.08 format or higher have additional features that were not included in the DOS-SAS data sets. The additional features are designed to speed processing, and include
We will not discuss these features here. DOS-SAS can not create data sets that have the Windows-SAS features. However, Windows-SAS can create DOS-SAS data sets. When reading a SAS data set, the SAS system needs to identify the type of SAS data set. It does so by identifying with the data set a SAS version, called an "engine".
There is an "engine" for each major change in data sets corresponding to a version of SAS. However, since the DOS versions 6.03 and 6.04 of SAS create identical data sets, and the Windows versions (6.08-6.12) create nearly identical data sets, we can distinguish between two principal engines (up to 1999). The Engines are:
While the version of SAS used to create a SAS data set is needed to read in a SAS data file, SAS data files using earlier SAS versions can be created using newer SAS engines.
SAS data files with the suffix *.ssd or *.sd2 do not uniquely identify the engine that created the data file, but are sufficient for SAS to read the data set. Engines are identified by specifying the "engine" option in a LIBNAME statements. For example,
LIBNAME old4 V604 c:\temp\old';
will associate with the LIBREF "old4" the engine "V604". Thus, files saved in C:\TEMP\OLD with SAS versions 6.03 or 6.04 can be accessed using the LIBREF "old4".
More than one LIBREF can be assigned to the same path if SAS data sets that have been created with different engines are stored in the same location. For example, we may have an additional LIBREF defined for SAS 6.10 data sets given by :
LIBNAME old10 V610 c:\temp\old';
The LIBREF "old10" would be used to identify SAS data sets that were stored using SAS 6.10.
Note that the "engine" is an option in a LIBNAME statement, and not essential. When no "engine" is specified, SAS 6.10 will determine the "engine" it considers best to use. The engine is identified as follows:
Once an "engine" is associated with a LIBREF in a LIBNAME statement, all files read from or written to the LIBNAME location are read or written using the "engine" assigned to the LIBNAME.
|
|
Produced and maintained by the
Dept
of BioEpi at UMASS |