Previous Page | Next Page

Using SAS Engines

The OSIRIS and SPSS Engines under OpenVMS


When Can You Use the OSIRIS and SPSS Engines?

The following read-only engines enable you to access files that were created with other vendors' software as if those files were written by SAS:

OSIRIS

accesses OSIRIS files.

SPSS

accesses SPSS and SPSS-X system files from (Release 9) or earlier and portable files.

You can use these engines in any SAS applications or procedures that do not require random access. For example, by using one of the engines with the CONTENTS procedure and its _ALL_ option, you can determine the contents of an entire SPSS file at once.


Restrictions on the Use of These Engines

Because these are sequential engines, they cannot be used with the POINT= option of the SET statement or with the FSBROWSE, FSEDIT, or FSVIEW procedures in SAS/FSP software. However, you can use the COPY procedure, the DATASETS procedure, or a DATA step to copy an OSIRIS or SPSS file to a SAS data set, and then use either POINT= or SAS/FSP to browse or edit the file. Also, some procedures (such as the PRINT procedure) issue a warning message indicating that the engine is sequential.


Accessing OSIRIS Files

Although OSIRIS runs only under z/OS and CMS, the SAS OSIRIS engine accepts an z/OS data dictionary from any other operating environment that is running SAS. The layout of an OSIRIS data dictionary is the same on all operating environments. The data dictionary and data files should not be converted between EBCDIC and ASCII, however, because the OSIRIS engine expects EBCDIC data.


Assigning a Libref to an OSIRIS File

To access an OSIRIS file, you must use the LIBNAME statement or LIBNAME function to assign a libref to the file. (Alternately, you can select Default as the type in the Engine field of the New Library dialog box.) Specify the OSIRIS engine in the LIBNAME statement as follows:

LIBNAME libref OSIRIS 'data-filename'
DICT= 'dictionary-filename';
where
libref

is a SAS libref.

OSIRIS

is the OSIRIS engine.

data-filename

is the physical name of the data file.

dictionary-filename

is the physical filename of the dictionary file. The dictionary filename can also be a fileref or an OpenVMS logical name. However, if you use a fileref or an OpenVMS logical name for the dictionary-filename, do not use quotation marks.

You do not need to use a LIBNAME statement before running the CONVERT procedure if you are using PROC CONVERT to convert an OSIRIS file to a SAS data file. (For more information, see CONVERT Procedure: OpenVMS.)

Note that the LIBNAME statement has no engine/host options for the SPSS engine.

If you previously assigned a fileref or an OpenVMS logical name to the OSIRIS file, then you can omit the data-filename in the LIBNAME statement. However, you must still use the DICT= option, because the engine requires both files. (For details, see Example: Accessing OSIRIS Files.)

You can use the same dictionary file with different data files. Enter a separate LIBNAME statement for each data file.


Referencing OSIRIS Files

OSIRIS data files do not have individual names. Therefore, for these files you can use a member name of your choice in SAS programs. You can also use the member name _FIRST_ for an OSIRIS file.

Under OSIRIS, the contents of the dictionary file determine the file layout of the data file. A data file has no other specific layout.

You can use a dictionary file with an OSIRIS data file only if the data file conforms to the format that the dictionary file describes. Generally, each data file should have its own DICT file.


Example: Accessing OSIRIS Files

Suppose you want to read the OSIRIS data file TEST1.DAT, and the dictionary file is TEST1.DIC. The following statements assign a libref to the data file and then run PROC CONTENTS and PROC PRINT on the file:

libname mylib osiris 'test1.dat' dict='test1.dic';
proc contents data=mylib._first_;
run;

proc print data=mylib._first_;
run;


Accessing SPSS Files

The SPSS engine supports portable file (export) formats for both SPSS and SPSS-X files. The engine automatically determines which type of SPSS file it is reading and reads the file accordingly.

This engine can read only SPSS export files from any operating environment that were created by using the SPSS EXPORT command.


Assigning a Libref to an SPSS File

To access an SPSS file, you must use the LIBNAME statement or LIBNAME function to assign a libref to the file. (Alternately, you can select Default as the type in the Engine field of the New Library dialog box.) Specify the SPSS engine in the LIBNAME statement as follows:

LIBNAME libref SPSS 'file-specification';
where
libref

is a SAS libref.

SPSS

is the SPSS engine.

file-specification

is the physical filename.

You do not need to use a LIBNAME statement before running the CONVERT procedure if you are using PROC CONVERT to convert an SPSS file to a SAS data file. (For more information, see the CONVERT Procedure: OpenVMS.)

Note that the LIBNAME statement has no engine or host options for the SPSS engine.

If you previously assigned a fileref or an OpenVMS logical name to the SPSS file, then you can omit the file-specification in the LIBNAME statement. SAS uses the physical filename that is associated with the fileref or logical name. (For details, see Example: Accessing SPSS Files.)


Referencing SPSS Files

SPSS data files do not have names. For these files, use member names of your choice in SAS programs.

SPSS data files have one logical member only per file. Therefore, you can use _FIRST_ in your SAS programs to refer to the first SPSS data file.


Reformatting SPSS Files

SAS cannot use an SPSS file that contain a variable with a numeric format that has a larger number of decimal places than the width of the entire variable. For example, if an SPSS file has a variable with a width of 17 and has 35 decimal places, SAS will return errors when you try to run a DATA step on the file or view it with the table viewer. To use the SPSS file with SAS, you have to reformat the variable.

You can reformat the variable by reducing the number of decimal spaces to a value that fits within the width of the variable. In the following code, the statement revision=cat(format,formatl,'.2'); converts the number of decimal spaces to 2. This value reduces the number of decimal spaces so that it is not greater than the width of the variable.

libname abc spss 'FILENAME.POR';
proc contents data=abc._all_ out=new; run;
filename sascode temp;
data _null_; set new; file sascode;
     if formatd > formatl then do;
        revision=cat(format,formatl,'.2');
        put 'format' +1 name +1 revision ';' ;
        end;
     run;
data temp; set abc._all_;
     %inc sascode/source2;
     run;

Note:   The OPTIONS NOFMTERR statement does not allow SAS to use a data set with a DATA step or the table viewer. You have to reformat variables that have a larger decimal space value than their width before you can use a DATA step or the table viewer.  [cautionend]


Example: Accessing SPSS Files

Suppose you want to read the SPSS file MYSPSSX.POR. The following statements assign a libref to the file and then run PROC CONTENTS and PROC PRINT on the file:

libname mylib spss 'myspssx.por';
proc contents data=mylib._first_;
run;

proc print data=mylib._first_;
run;

Previous Page | Next Page | Top of Page