Changing SAS File Formats


Changing a File's Format at the Source or Target Machine

You can change a SAS file's format at the source or target machine.

At the Source Machine

Create a SAS file in the format of the "foreign" target machine. Transfer the file to the target machine.

At the Target Machine

Transfer the file from the source machine to the target machine. At the target machine, change the file to the format of the native target machine.

Using the OUTREP= Option in the LIBNAME Statement

In order to create a SAS file in a "foreign" format for a supported member type, use the OUTREP= option in the LIBNAME statement.

The OUTREP= option applies the designated format to all SAS files that are created in the specified library.

Note  

Whereas the OUTREP= option in the LIBNAME statement applies to all files being created in the specified library, the OUTREP= option in the DATA step applies only to the specific data set being created.

Note  

MDDB files cannot be updated on a target machine. CEDA supports MDDB files for read-only access.

Example:

 libname grades  '/dev/app/unc'  outrep=windows; 

The libref GRADES points to the location for the application and its data sets. The data set output is represented in Windows format.

For supported values for the OUTREP= option, see the LIBNAME statement in SAS Language Reference: Dictionary .

Using the OUTREP= Data Set Option in the DATA Step

In order to create a SAS file in a "foreign" format for a supported member type, use the OUTREP= option in the DATA step.

The OUTREP= option applies the designated format to the specified data set.

Note  

Whereas the OUTREP= option in the DATA step applies only to the specific data set being created, the OUTREP= option in the LIBNAME statement applies to all files being created in the specified library.

Example:

 data chem.grades (outrep=HP_UX);   input student $ test1 test2 final;   datalines; Fred 66 80 70 Wilma 97 91 98   run; 

The data set GRADES is created in HP_UX format.

For supported values for the OUTREP= option, see the DATA step in SAS LanguageReference: Dictionary .

Viewing the SAS Log at the Source Machine

Viewing the SAS log verifies that the output of the data set (UNIX) is in a format that is foreign to the native environment (Windows).

Output 2.1: Data Representation Specified in the SAS Log
start example
 The SAS System        10:15 Friday, December  19, 2003   1                                       The CONTENTS Procedure      Data Set Name      WORK.GRADES                          Observations          1      Member Type        DATA                                 Variables             4      Engine             V9                                   Indexes               0      Created            11:03 Friday, December 19, 2003      Observation Length    32      Last Modified      11:03 Friday, December 19, 2003      Deleted Observations  0      Protection                                              Compressed            NO      Data Set Type                                           Sorted                NO      Label      Data Representation   HP_UX_64, RS_6000_AIX_64, SOLARIS_64, HP_IA64  [1]      Encoding          latin1   Western (ISO)                                 Engine/Host Dependent Information        Data Set Page Size          4096        Number of Data Set Pages    1        First Data Page             1        Max Obs per Page            126        Obs in First Data Page      1        Number of Data Set Repairs  0        File Name                   C:\TEMP\SAS Temporary Files\_TD228\grades.sas7bdat        Release Created             9.0000M0        Host Created                WIN_NT  [2]                         Alphabetic List of Variables and Attributes                                #    Variable    Type    Len                                4    final       Num       8                                1    student     Char      8                                2    test1       Num       8                                3    test2       Num       8 
end example
 
[1]  

The data set is represented in HP_UX format, which is "foreign" to the native Windows environment.

[2]  

The native format is WIN_NT.




Moving and Accessing SAS 9.1 Files
Moving And Accessing SAS 9.1 Files
ISBN: 1590472306
EAN: 2147483647
Year: 2004
Pages: 109
Authors: SAS Institute

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net