Determining the Encoding of a SAS Session and a Data Set

Encoding of a SAS Session

To determine your current SAS session encoding, which is the value assigned to the ENCODING= system option, you can use the OPTIONS procedure or the OPTIONS window. For example, the following PROC OPTIONS statement displays the session encoding value:
proc options option=encoding;    
run; 
The SAS log displays the following information:
ENCODING=WLATIN1 Specifies default encoding for processing external data.
You can also determine the SAS Session Encoding by using the following command:
%PUT %SYSFUNC(getOption(ENCODING));

Encoding of a SAS Data Set

To determine the encoding of a specific SAS data set, follow these steps:
  1. Locate the data set using SAS Explorer.
  2. Right-click the data set.
  3. Select Properties from the menu.
  4. Click the Details tab.
    The encoding of the data set is listed, along with other information.
    You can also determine the encoding by using the following command:
    %LET DSID=%SYSFUNC(open(sashelp.class,i));
    %PUT %SYSFUNC(ATTRC(&DSID,ENCODING));
    
You can display the encoding of any SAS 9 data set by using the CONTENTS procedure or the Properties window in the SAS windowing environment.
An example follows of output that is reported from the CONTENT procedure in the SAS log. The encoding is Western latin1.
Encoding Reported in the SAS Log
The SAS System       10:15 Friday, June 06, 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, June 06 2003      Observation Length    32
     Last Modified     11:03 Friday, June 06, 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   
     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   


                        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