New Features: SAS V8

Notes on: New Features in Version 8 of the SAS
System

 

last update: 28OCT2000


ALL STATISTICAL SEMINARS REQUIRE WINDOWS knowledge or experience at
INTERMEDIATE Level.

This seminar also requires MASTERING OF SAS CONCEPTS AND TERMINOLOGY.

     

     
     
     

     

     
     
     

    I. Summary of Features, Help, Transition, and System Options

     


     

     
     
     

    II. New SAS Windows: Explorer, Shortcuts, and Results

     

    SAS Explorer

      The SAS Explorer is similar to the WINDOWS EXPLORER in that it aids you
      to manipulate your SAS files. It has been designed to also help you
      navigate your libraries and easily access your SAS programs. The main
      window, also referred to as the TOP LEVEL WINDOW, shows two icons:
      LIBRARY, and FILE SHORTCUTS.

      If we click on the SAS Explorer icon [second from right], we see that the
      SAS Explorer is works pretty much like the Windows Explorer. You will
      notice that this window is now titled EXPLORER (2) since the first copy of
      the SAS Explorer window is open in the docked pane at the left. The SAS
      Explorer has a navigation pane [left] where you can determine
      the directory location that you are browsing and a listing of file in that
      directory on the right pane.

      Some of the options that can be set which affect the way SAS Explorer
      looks and feel are under the pull down menu VIEW.


      Exercises:

        Undock the SAS EXPLORER window…

        • Go to TOOLS | OPTIONS | PREFERENCES, select VIEW and deselect
          DOCKING VIEW. Now the SAS EXPLORER window is can be placed anywhere as
          with the other windows in SAS.

        Open an additional Explorer window…

        • Click on the Explorer icon on the application toolbar [second from
          the right], and a new SAS explorer window will open on top of the right
          pane in SAS.

        More explorations…

        • With the SAS Explorer open, click on VIEW | SHOW TREE

    Defining a new LIBRARY

    • Point and click:Make sure that you are at the TOP LEVEL of the SAS Explorer where you only
      see the LIBRARIES and the FILE SHORTCUTS icons. If you are not at the top
      level, you will notice that there is an UPLEVEL icon on the TOOLBAR with
      an up arrow depicted within a folder- this icon means “go up one level’.

      Click on the EXPLORER tab. You will see a listing of ACTIVE LIBRARIES.
      Note that when selecting an icon by highlighting it, depending the icon
      you select in this window the possibilities are different.


      Exercises:

      • RIGHT CLICK on the ACTIVE LIBRARIES window various times. Each
        time select a different icon via highlighting it by clicking on it once.

        • What is different in the list of options provided to you?
        • What happens if you click on the NEW icon on the TASKBAR?
        • What happens if you click on VIEW and select one of the first four
          options [LARGE ICONS, SMALL ICONS, LIST, or DETAILS]?

        Assigning Libraries…

      • Highlight LIBRARIES icon and right click | NEW
      • View PROC contents information [GENERAL PROPERTIES, ENGINE/HOST
        INFORMATION, COLUMNS, INDEXES] by:

        • right clicking on the file | PROPERTIES
        • right clicking on the file | VIEW COLUMNS
      • Double click on a file in a library to open file in VIEWTABLE.
      • On the TOOLBAR, click on the NEW icon [blank page
        icon]. You will see a dialog box where you can enter all appropriate
        information, including path, library nickname, and ENGINE. This is
        particularly important since the default engine is V8. You can select for
        the engine to be V6 or V8.
    • Syntax:The syntax to assign a library is as always…

      LIBNAME libref  '('SAS-data-library-1' ) '  ;


      Where engine-name can be anyone of the following engines which
      are supported under Windows.

      Engine-name		Accesses
      V7 		Version 7 data sets. 
      V6 		Release 6.08 through Release 6.12 data sets. 
      V8 or BASE 	Release 8 data sets. 
      V612 		Release 6.12 data sets. 
      V611 		Release 6.11 data sets. 
      V610 		Release 6.10 data sets. 
      V609 		Release 6.09 data sets. 
      V608 		Release 6.08 data sets. 
      V604 		Release 6.03 and Release 6.04 data sets. 
      XPORT 		transport format files. 
      BMDP 		BMDP data files. 
      OSIRIS 		OSIRIS data files. 
      SPSS 		SPSS system files. 
      

    Creating a new CATALOG, QUERY, or TABLE

      Highlight the WORK library and right click
      on the mouse. This will also give you an option of NEW. Select NEW, and
      you will be prompted depending what new object you want to create. TABLE
      will open a VIEWTABLE window for data entry.

      What’s in that file???

      After you created a new TABLE, you can right click on that table and you
      will offered a window with information the following for that data file.


      General Properties
      Date of creation, number of variables and cases, filename,
      Engine, and other HEADER information

      Engine/Hosts information
      More HEADER information including file location

      Columns
      Variable names, Type, lenght, format, informat, and label

      Indexes
      Index, unique, missing, and columns

    File shorcuts

      The SAS explorer allows you to create shortcuts to your favorite
      text files; that is your .sas programs. This save you
      time and hassles in finding those SAS programs that you use very
      frequently. Additionally, you can also submit your programs from a FILE
      SHORTCUT.

      Shortcuts are assigned temporarily during your SAS session. Alternatively,
      you can generate all the shortcuts you desire upon opening your SAS
      session by modifying/creating your
      autoexec.sas file and adding a
      set of lines for each file shortcut you want. Alternatively you could just
      achieve this by selecting ENABLE AT STARTUP in your local installation.
      Otherwise, and if you use the ACCC labs, you could create
      a file which setsup the shortcuts depending the project you are working
      on. For example, say I want to create a shortcut for the
      files seminar1.sas, seminar2.sas, seminar3.sas, seminar4.sas, I
      could write a SAS program file
      seminars.sas
      which would set all
      my shortcuts, as follows:

      options ls=80;
      %let path=D:\Datatemp\sasuser\;
      filename seminar '&path\seminar1.sas';
      filename seminar '&path\seminar2.sas';
      filename seminar '&path\seminar3.sas';
      filename seminar '&path\seminar4.sas';
      


      This code will facilitate changing the path via the %let macro,
      and will also create the icons in the ACTIVE FILE SHORTCUTS window.
      Similar code can be written in your autoexec.sas file to be submitted
      upon
      opening your SAS session. After seminars.sas has an icon in the
      ACTIVE FILE SHORTCUTS window, I can SUBMIT it just by right clicking on
      it, and selecting SUBMIT.


      Exercise:

      • Create a shortcut…
        • Double click on the FILE SHORTCUTS icon
        • Select FILE, NEW
        • Provide a shortcut name AND path for the file.
      • Enter, submit, save, and set shortcuts for frequently used
        programs…

        • Create new SAS program
        • FILE | SAVE AS
        • RUN |SUBMIT
        • shortcut: Highlight FILE SHORTCUTS icon and right click | NEW
        • View and navigate output

Results Windows

    The SAS Results window assists you to locate
    parts of your output within the OUTPUT window. Both of these windows are
    by default docked on the left pane of the SAS program. You can either open
    a new Explorer window or undock the one that is opened.

 

 
 
 

III. Enhanced Editor Window

 

    The ENHANCED EDITOR window offers a set of new features:

  • color coding of your SAS syntax,
  • multiple EDITOR windows- a new
    window is opened every time you open a new .sas file,
  • flow view of your syntax,
  • automatic indent,
  • default and user function keys,
  • macros for code editing.SAS code is color coded such that you can clearly differentiate between
    step boundaries, keywords, column names, table names, and constants.
    This color coding is dependent on what you have typed, inclusive of
    errors. So, for example, the code:


      data nuevo;
      set ptesth.ex1;
      run;
      proc print; run;

      would look like this, if you made a typo in the word DATA…


      dat nuevo;
      set ptesth.ex1;
      run;
      proc print; run;

    and it would look like this, if you made a forgot your semicolon…


      data nuevo
      set ptesth.ex1;
      run;
      proc print; run;

    Of course, you can go to TOOLS | OPTIONS | ENHANCED EDITOR, and change the
    particular settings, colors and other preferences, for your Enhaced editor
    window. One of these options is CLEAR TEXT ON SUBMIT. This replicates the
    behaviour of previous versions of SAS where the code is cleared from the
    editor window upon submission.


    Try this…

    • Automatic comments: TOOLS | ADD ABREVIATIONS
        What happens when you type the ABREVIATION name in your code?
    • User shortcuts: TOOLS | OPTIONS | ENHANCED EDITOR KEYS.

 

 
 
 

IV. Changes and New options in SAS Language

 

    Note that SAS is introducing with V8, conventions typical of spreadsheets;
    that is, refering to variables as columns, and datasets as
    tables.

  • Naming Conventions:
    • 32 character names for:
      columns [variable names], SAS tables [SAS datasets], catalogs and catalog
      entries, macro variables, macros, arrays, integrity constraints, statement
      labels.
    • 8 character names still for: librefs, filerefs,
      formats, informats.
      These names interact with the OS and need to be maintained as 8 characters
      to allow for compatability across OS’s.
    • Libraries can be named:

      "c:\path\filename"
      in addition to
      the regular libref.member format.
      In the case of using the full path, ther is no need to write the extension
      since SAS assumes the data file extension for the operating system.

        E.g.: proc print data="c:\datatemp\ex1"; run;
    • SAS dataset names [tables] are not case sensitive.
    • Variable names [columns] can be mixed case- although
      comparisons are case insensitive.
    • Column and table labels can be up to 256 characters [formerly
      40].

        E.g.:

        proc print data="c:\datatemp\ex1" label;

        var region quantity amount;

        title="Testing a long label";
        label region="I wish I live where the ocean rests, and where the
        seagulls nest, instead of here, where the snow man goes out to eat... it
        is cold... it is winter.. I want to go home.. instead of being here...
        today in this cold and frigid day. Ahh the good old days of summertime!";

        run;


    • Character data values can be up to 32,737 characters [formerly
      200]. This new characer data value lenght is supported by: LENGHT, ATTRIB,
      and ARRAY statements.

  • SET statement.

    • POINT= variable

      <- can be used with compressed SAS tables [datasets].

    • OPEN= IMMEDIATE | DEFER
      <- opens only the first table
      that is listed in the SET statement during compilation. By default
      [IMMEDIATE],
      all tables listed in a SET statement are opened simultaneously. DEFER
      postpones opening of the table until it *has* to be read during execution.
      This results in better memory resources utilization.

  • FILE statement.

    • DELIMITER= 'delimiter(s)'

      or
      DLM= 'delimiter(s)'
      <- delimiter to be
      assumed separting each data column other than a blank space. For a TAB in
      an ASCII system, use LIST input and the following statement:
      dlm='05'x
    • DSD <- Outputs delimited data-
      default is comma delimited.
    • FOOTNOTES <- allows DATA step
      reports created with PUT statement to use footnotes.

  • System Options
    • YEARCUTOFF= <-- Year from which
      SAS assumes a 100 year span. Default=1920.
    • DATASTMTCHK= COREKEYWORDS |
      ALLKEYWORDS | NONE
      <-- controls
      using DATA step keywords [as one-level table names. COREKEYWORDS prevents
      you from using SET, MERGE, RETAIN, and UPDATE. ALLKEYWORDS prevents you
      from using any data step keyword, such as INFILE, INPUT or ARRAY. NONE
      allows for any DATA step keyword to be used as a one-level name.
    • VALIDVARNAME= V7 | UPCASE | V6 | ANY
      <-- Tells SAS to store the column name with: up to 32 characters
      [V7], all in uppercase and up to 32 characters [UPCASE], or in uppercase
      and up to 8 characters [V6]. By forcing the naming of your columns, you
      can create an easier transition when sharing data files with your peers
      who might not have access to V8. ANY should not be used unless you are
      using relational databases.

    <!--
    =

      E.g.: .

  • = variable
    -->

  • Other new or improved functions:
    • SCAN(text,[-]n,delimiters)
      <--scans from frigh tot left by -n places
    • QUOTE(argument)
      <--no trailing blanks trimming before quoting
    • PUT(source,format-alignment)
      <--allows justification. Format-alignment can be left [-L], right [-R], or
      center [-C].
    • DATDIF(sdate,edate,basis) <--
      returns the number of days between the 2 dates.
    • YRDIF(sdate, edate,basis)
    • MISSING(expression) <-- checks
      for missing value. Returns 0, if argument does not contain a missing
      value, and 1 if it does.


 

 
 
 

V. ODS

 

    Output from SAS V6 or earlier had some limitations given its focus
    on a output for a printer: output was always in the same font, its
    contents could not be parsed, and was restricted to one form of output,
    namely the list file. With version 7 and higher, SAS introduced
    the Output Delivery System [ODS]. The purpose of ODS is to allow
    for a greater flexibility in the form and type of output SAS can generate.

    By invoking ODS, you can:

    • Generate SAS data files [tables] as the output of PROCedures.
    • Costumize reports.
    • Send output to a variety of destinations. There are two types of
      destinations: Report and Data. Report destinations
      include: LISTING, HTML,
      and PRINTER -which can be either postscript or PCL. Data
    • Select, and/or exclude, any part [components] of your output.
    • If more than one component is generated, organize and manage your
      output.

    For example, PROC UNIVARIATE generates five components: Moments, Basic
    Measures of Locations and Variability, Tests for Location, Quantiles, and
    Extreme Measures. Previously, you had to generate all those five parts to
    get the one you needed. Now with ODS, you can tell SAS to print out just
    the one section you desire!

    ODS Statements.

    Note that when you invoke ODS you are
    "opening" a process which has to be closed. Each "process" creates a type
    of output. Failing to close one "process" implies that you want that
    process to generate output. You have to invoke ODS before
    the PROC whose output you want to modify, and tell ODS to close this
    process when the PROC is done.
    In many cases, there will be no harm
    in leaving the process open, besides the nuissance of generating a type of
    output that you do not need.

    Here is a list of ODS statements:

      For opening, closing, and/or managing the ODS destination...

    • ODS LISTING | CLOSE;
        This is the assumed default of ODS. By ommiting any ODS statement, ODS
        LISTING will be executed. This default implies: monospaced fonts, no tab
        information, and PROC specific priting routines. Outputs: OUTPUT for
        text, GRAPH1 for SAS/GRAPH. To send output to an external file, you can
        use the following syntax:

        ODS LISTING FILE='file specification' |
        fileref


        Try this...

        		data;
                        input name $ gender $ age height weight;
                        cards;
                        ALFRED  M  14  69.0 112.5
                        ALICE   F  13  56.5  84.0
                        BARBARA F  13  65.3  98.0
                        CAROL   F  14  62.8 102.5
                        HENRY   M  14  63.5 102.5
                        JAMES   M  12  57.3  83.0
                        JANE    F  12  59.8  84.5
                        JANET   F  15  62.5 112.5
                        JEFFREY M  13  62.5  84.0
                        JOHN    M  12  59.0  99.5
                        JOYCE   F  11  51.3  50.5
                        JUDY    F  14  64.3  90.0
                        LOUISE  F  12  56.3  77.0
                        MARY    F  15  66.5 112.0
                        PHILIP  M  16  72.0 150.0
                        ROBERT  M  12  64.8 128.0
                        RONALD  M  15  67.0 133.0
                        THOMAS  M  11  57.5  85.0
                        WILLIAM M  15  66.5 112.0
                        run;
                        ods listing;
          		    proc print; run;
         		ods listing close;
          		    proc print; run;


      • Read the SAS log. What happened after the command ods
        listing close;
        ?
    • ODS HTML
      | CLOSE |

      PATH='path-for-saving-html-file (URL=base address | NONE)

      BODY='filename.html' fileref

      CONTENTS="contentsfile.html" PAGE="pagefile.html"
      FRAME="framefile.html"
      NEWFILE=NONE | PROC | OUTPUT| PAGE
      STYLE="style-definition"

      ;

        ODS HTML opens, closes, or manages the HTML file output destination.
        This means that you can make SAS generate a static web page with your
        analysis.

        Options:

        • The FILE= option is an alias for BODY=.
        • The CONTENTS= option generates a
          file with links to the individual
          parts contained in the BODY= file.
        • The
          PAGE= option creates a file with links to the
          individual pages of output contained in the BODY= file.
        • The FRAME= option creates a file with
          the information from both the CONTENTS= and the PAGE= files.
        • You can control when an HTML outputs is generated via the NEWFILE=
          option. It is
          possible to create a new .html file for each: procedure [PROC],
          output-object [OUTPUT], new page [PAGE]. By default, NEWFILE=NONE which is
          a single output file.
        • STYLE= option allows you to select one of the standard presentation
          schemes for your data. The current available styles are:

        • Default
        • Beige
        • D3D
        • Printer
        • Brown
        • serifPrinter
        • Minimal
        • Brick
        • StatDoc
        • FancyPrinter
        • SansPrinter
        • SASdocPrinter
        • You can also use HTML font attibutes inside of your titles or
          footnotes. For example, some font options are:

          Attribute values STYLE= attribute
          Face Times, courier, arial FONT_FACE
          Weight medium, bold FONT_WEIGHT
          color green, red, yellow,
          etc
          BACKGROUND
          FOREGROUND
          style Italic, roman FONT_STYLE
          size 1 to 7 FONT_SIZE
          width normal, narrow, wide FONT_WIDTH

        To send output to an HTMLfile:
        ODS HTML BODY='html file specification' |
        fileref

        The following code will generate an html file named newfile.html, in addition to opening a
        browser window in your SAS session since this code does not include
        a ods listing close; statement.

        If you want to have a nicer title for your table of contents than that of
        the analyses you ran,
        you can use ODS PROCLABEL to change the default title. You would write:
        ods proclabel 'This is my new title';

        This statement goes before the ods html;
        statement.


        Try this...

        ods proclabel 'My First SAS output in HTML!';
        ods html path='c:\temp\' (url=none) body='newfile.html';
        proc univariate;
        title 'This is my new title in purple';
        var quantity amount;
        run;
        ods html close;
        

        Within PROC REPORT and PROC TABULATE, you can also more fancy things. I
        just include one simple example:

        ods listing close;
        ods html path='d:\sasdata\' (url=none) body='newfile2.html';
        proc tabulate style={background=pink foreground=blue font_face=simplex
        font_weight=bold};
        title 'This is using Proc tabulate';
        class region saletype citysize product; 
        var quantity amount pop;
        tables region, saletype, citysize
        /style={background=red foreground=blue font_face=courier
        font_weight=bold};
        run;
        ods html close;
        ods listing;
        

        Furthermore, you can use PROC FORMAT to create a format to be used for a
        STYLE to be used for particular subset of conditions within the PROC
        TABULATE procedure
        [Output file from a SAS example].

        Or you can use styles within PROC REPORT to modify your table
        [Output file from a SAS example].

        In addition, you can use HTML tools like clickable areas in graphs, to
        spice up your table and provide more information to the user
        [Output file from a SAS example].

    • ODS PRINTER| CLOSE
      STYLE=style | PRINTER=printer name |
      FILE=file name | NOCOLOR|COLOR POSTSCRIPT|PS;

        Uses default printer as specified in the SAS registry for that operating
        system.
    • ODS OUTPUT
      output-object(MATCH_ALL)=sastable| CLOSE;

        This statement allows you to open and create a table [SAS dataset]
        with the output from any of your analyses, therefore facilitating
        further analyses. For example, you can now save as a SAS data file,
        the correlations yielded from one of your analyses.

        The format for referencing the output-object and the new file to
        be created is:output-object=libref.filename.
        See ODS TRACE for more on output-objects.

        libname cdir "c:\temp\";
        ods listing close;
        ods output BasicMeasures=cdir.measures Quantiles=cdir.quantiles;
        proc univariate; 
        var quantity amount;
        run;
        ods listing;
        


        The preceeding code creates 2 files in the cdir library: measures and
        quantiles. Below is what the BasicMeasures file would contain.

        VarName  LocMeasure LocValue  VarMeasure            VarValue
        QUANTITY Mean       554.4722  "Std Deviation"       262.34484
        QUANTITY Median     662.5000  Variance              68825
        QUANTITY Mode       880.0000  Range                 745.00000
        QUANTITY            _         "Interquartile Range" 495.00000
        AMOUNT   Mean       12486.04  "Std Deviation" 6116
        AMOUNT   Median     14750.00  Variance 37410627
        AMOUNT   Mode       15000.00  Range 19375
        AMOUNT              _         "Interquartile Range" 11613
        

        The option
        MATCH_ALL allows for separate tables to be generated for each
        of the output-objects selected when you:

        • use BY group processing
        • repeat analyses for multiple variables [columns].

        If you use this option, ODS
        will
        automatically name the tables: sastable1, sastable2...sastableN, up to
        the number of tables needed for all the output objects.

        ods listing close;
        ods output BasicMeasures=cdir.measures;
        proc univariate; 
        var quantity amount;
        by region;
        run;
        ods listing;
        


        The preceeding code will generate one BasicMeasures table for each
        value of REGION with filenames measures#, where the pound sign is each
        instance of new number needed for each case of REGION.

      For managing and/or documenting output parts...

    • ODS TRACE ON | OFF ;
        This statement is used to determine the names of the output objects
        generated by the PROC you will be running. After determining the name of
        the objects, you can use either ODS EXCLUDE or ODS SELECT to choose the
        objects you want to keep or drop.


        Exercise:

        data ;
         set ddir.ex1;
        run;
        ods trace on;
         proc univariate; 
         var quantity amount;
         run;
         proc print; run;
        ods trace off;
        

        This exercise yields a SAS log file with
        information on the objects and a
        corresponding SAS output.

    • ODS destination EXCLUDE
      selections ALL | NONE ;

      and ODS destination SELECT selections ALL | NONE;

        These statements reference the particular objects you want to select
        or exclude from you actual output from the OVERALL list which is created
        by the PROCedure you are using. Remember that you can list the output
        objects via the command ODS TRACE. The individual list of objects
        is processed first, then the overall list of objects is processed.

        Output objects can be referenced by their path, label or number:

        • full path --> Univariate.QUANTITY.BasicMeasure
        • partial path: Any part of the full path after the period until the
          end of the full path -->
          QUANTITY.BasicMeasure or
          BasicMeasure
        • label [surrounded by quotation marks]:
          " Basic Measures of Location and Variability"
        • label path: Need to use ODS TRACE /LABEL; and you will get the LABEL
          path. -->
          "The Univariate Procedure"."QUANTITY"."Basic
          Measures of Location and Variability"
        • partial label path: any part of the label after a period and
          continues to the end of the path.
        • mix of labels and paths.
        • Pound sign and a number [#n] after the label or path refers to the nth
          output of the object named. -->
          BasicMeasure#4 refers to the fourth BasicMeasure
          output.
    • ODS SHOW ;
        This statement displays what will be generated or excluded for a specified
        destination. For example if I use ODS show after generating the ODS TRACE
        example, you will get in the LOG window:

        ods listing show;
        Current LISTING select list is set to default value (ALL).
        Current OVERALL select list is: ALL


        Exercise:

        ods listing select BasicMeasure;

        ods show;

      For specifying, searching, and/or customizing documents...

    • ODS PATH ;
    • ODS VERIFY ;

 

 
 
 

VI. Changes to the Data Library

 

    Remember that by default, SAS 8 assumes the V8 engine to be used if
    nothing is specified. SAS can recognize that one data file is of one
    version given that file's extension. IF a directory ONLY has V6 files,
    the V6 engine will automatically be assigned for that LIBREF when using
    the LIBNAME statement.

    • SAS 8 can read/write/update V6 data but you CANNOT use V8 features,
      like long variable names.
    • SAS 8 cannot read V6 catalogs created on AIX [tigger]. On
      other hosts, it can read v6 catalogs, but they must be converted to be
      updated.
    • SAS 8 cannot read V6.06 files created on OS/390 [mainframe].
    • SAS 6 CANNOT read V8 tables [data files], views, or catalogs.
    • To create V6 datasets from V8 datasets by using the
      VALIDVARNAME=V6 system option when using
      the DATA step and COPY procedure. The VALIDVARNAME option will yield a
      syntax error if you use long variable names when creating a V6 data file.

    V8 Access to V6 files

    TABLES READ/WRITE/UPDATE
    DATA step views read[v8]/none[v7]
    SQL views Read
    SAS/ACCESS views Read/write/update
    Catalogs read
  • Conversion of SAS data files:
      Catalogs may or may not be forward or backward compatible depending
      on the
      file format used to create that catalog, which is dependent on the version
      used upon creation.

    • PROC COPY: datasets [tables], or catalogs. This procedure leaves the
      entries in V6 format until updated. Only those updated are converted to
      V8, otherwise the entry remains in V6.
    • DATASETS procedure with the COPY statement: datasets.
    • DATA step: datasets.
    • PROC CPORT or PROC CIMPORT: catalogs. These procedures use the V6
      catalog as input and create a V8 format catalog. See PROC COPY.
  • Concatenation of libraries from different Engines:
      Concatenating directories is useful to simplify V6 and V8 data
      management. I think this example explains the concept...

      libname ddir "d:\sasdata\";
      libname dat8 "d:\sasdata\data";      /* version 8 files */
      libname dat6 V612 "d:\sasdata\data"; /* version 6 files */
      libname dat (dat8,dat6);	/* both */
      


      This method can also be used for concatenating
      libraries which contain CATALOGS. Catalog contatenation can also be done
      via the CATNAME statement.

      CATNAME
      libref.catmember
      (libref1.catmember libref2.catmember...) options

      Note that upon using this method the libref.catmember
      exists as a virtual alias- there is no physical directory named this way.
      This means that this virtual directory represents a logical concatenation
      for which it will not be listed in the EXPLORER window.

      Some rules...

      Explicit concatenation definitions take precedence [Implicit is if
      you use the LIBNAME statement].
  • Generation datasets:
      Now you can keep track of the historical [or different] versions of your
      data. Therefore, you can have multiple copies of the same SAS dataset and
      archive the data without having to change date of creation. Say we
      have the file
      mydata.sd2
      and I have some code as
      follows:

      data cdir.mydata;set cdir.mydata; run;

      Typically, such code will result in overwritting of
      mydata.sd2. When the generations datasets
      statement is invoked, and if the name of the SAS dataset is the
      same, SAS will keep track of the historical version instead of overwriting
      the file. Terms you might need to know:

      • Historical version: all versions of the file
      • Base version: most recently created version
      • Version: any file in the "generation set" of files.
      • Generation group: all versions of the same file.
        inclusive of the most current.
      • Version number: last 4 characters of the file name- 999
        versions maximum
      • Youngest version:
        version chronologically closest to the base version.
      • Oldest Version: version chronologically farthest to the base
        version.

      You would need to determine how many copies of the data file you want to
      keep, then SAS will append numbers at the end each time to "overwrite"
      this file, and upon reaching the total number of files allowed the numbers
      on the file name will continue to increase but the total number of files
      will remain as you determined.

    • GENMAX=|> 0:
      establishes how many generations to simultaneously maintain.
    • GENNUM= -1 | 0 | 1
        Where...

      • -1= youngest version
      • 0= current version
      • 1= first version created
        And if...
      • >0 ...implies an absolute reference to the historical version by its
        generation number.
      • < 0 ... implies a relative reference to the historical version.
      • = 0 ... implies the current version.

      Things to keep in mind:

        Do's:

      • You can browse or update historical versions.
      • You can transfer generations witih PROC COPY.
      • You can use PROC DATASETS to delete all or some of the generations,
        rename an entire generation or any member to a new base name, change the
        GENMAX value.

        Dont's:

      • You cannot keep the version number if you rename the file.
      • You cannot open a historical version for output.

      Try this...

      data ddir.ex1 (genmax=3); set ddir.ex1; run;

      <!--
      aqui


      Try this...

      CATNAME
      libref.catmember
      (libref1.catmember libref2.catmember...) options

      Is
      -->

  • Indexing:
      If you index a SAS dataset, facilitate extraction of data, in particular
      when using the WHERE clause. This helps to improve sequential access to
      your data in a form which is more efficient.

      See SAS
      ONlineDOcs
      for more on this command and its syntax.

      Enhancements:

      • Pattern matching with LIKE operator.
      • Can use multiple WHERE clauses against composite indexes: Ranges, IN
        and EQ operators, in particular.

      New WHERE expression options to control the use of indexes. These are:

      IDXWHERE YES | NO

      IDXNAME YES | NO

  • Integrity Contraints.
      You can control in SAS the rules to be followed to perform data
      value checking. You do this by specifying integrity constraints
      to do data validation when you update, insert, or otherwise modify your
      data values. To do such modifications, you would be using: FSVIEW,
      viewtable window, FSEDIT, DATA step with
      the MODIFY statement, PROC SQL with the INSERT INOT or SET statements,
      and the PROC APPEND statement.

      Things to know about intergrity constraints:

      • Are part of BASE SAS V8 and Follow ANSI standards.
      • cannot be defined for views or for historical versions of data.
      • General Contraints: Restrict the accepted data values for a
        variable.

          NOT NULL: garantees nonmissing values in each
          row for corresponding variables

          CHECK: verifies for specific values or range of
          values.

          UNIQUE: enforces unique values for that variable.
      • Referential Constraints
        • PRIMARY KEY: Combines the NOT NULL and UNIQUE
          options. Uses the specified variable as a that table's primary key based
          on one or more variables.
        • FOREIGN KEY: Creates a "parent/child"
          relationship between one or more variables in one data set [table] with a
          primary key in another data set. This is done by linking one or more
          rows in one table to a specific row in another table. This restricts the
          acceptable modifications to be the values of the primary key or missing.
      • Methods to create integrity contraints: PROC SQL, PROC DATASETS, SCL.

      See SAS
      ONlineDOcs
      for more on this command and its syntax.


 

 
 
 


VII. Changes and enhacements to PROCedures

 

    There have been some enhacements and additions to the BASE SAS
    procedures.

  • PROC FORMAT
    • PROC FORMAT; VALUE
      valuename (MULTILABEL)
      ...
      : allowsmultiple values for a range or overlapping
      ranges.
  • PROC TABULATE
    • PROC TABULATE ;

      ...
      CLASSvar/ MLF
      : uses the multilabel format
      defined with PROC FORMAT, taking advantange of the ovelapping ranges but
      records will be counted twice.

  • PROC MEANS
  • PROC PRINT
  • PROC REPORT
  • PROC SORT
  • PROC SQL
  • PROC TABULATE
  • PROC IMPORT
  • PROC EXPORTAs well as some changes and enhancements to the SAS/GRAPH procedures.
  • PROC GCHART.
      You can now generate three
      dimensional horizontal and vertical bar, and pie charts with PROC
      GCHART. The syntax is:
      PROC GCHART; HBAR3D | VBAR3D chart
      variables / options

      There are also a series of new options:

    • FONTREF: draws reference lines
      in front of 3D graphs.
    • OUTSIDE=statistic:
      displays the statistic above the bar.
    • INSIDE=statistic:
      displays the statistic inside the bar.
    • NOPLANE: supresses all
      vertical or/and horizontal planes in the 3D graphs.
    • statistic-nameLABEL='string'
      : controls the text of the statistics headers.
    • SHAPE=BLOCK | CYNLINDER | HEXAGON
      | PRIMS | STAR
      : this option changes the shape of the 3D
      bars.
    • SPLIT='character' :
      defines a character that will cause a text line to split upon needed to
      wrap long axis labels.
    • COUTLINE=SAME |color:
      specifies the colors for outline of the bars or slices of the chart. SAME
      matches the outline with the color of the bar or slice.
    • WOUTLINE=n: changes the width
      of the outline width of the bars or slices of a graph.
    • NOFRAME: prevents default frame
      to be drawn around plot.
  • PROC GPLOT
      Now you can use the SYMBOL statement to control the width of the box whan
      using the
      INTERPOL=BOX or the
      INTERPOL=HILOB options for box and
      whisker plots. The option
      BWIDTH has been added to the
      syntax.

      The syntax is:
      SYMBOL I=BOX F | J | T | HILO
      C | B | T | J
      CV=color CO=color

      See SAS
      ONlineDOcs
      for more on this command and its syntax.

  • ANNOTATE facility: new options.
    • CBORDER=color : draws
      a border of the specified color around the label or symbol. Unfilled box
      by default.
    • CBORDER='CTEXT': draws a border
      around a label or symbol. Unfilled box.
    • CBORDER='': turns CBORDER off.
    • CBOX=color :fills box
      with the specified color behind the label or symbol.
    • CBOX='CBACK' : fills
      box withthe same color as that specified for CBACK. No borders.
    • CBACK='' : turns COBX
      off.
  • LEGEND statement: new option.
      LEGEND FWDITH=n: controls
      the thickness of the line of the legend frame drawn.

 

 
 
 


VIII. Other Changes

 

  • SAS/ACCESS
    • New or improved formats:
      Character formats are compatible with the new 32K limit restriction.
    • PROCS: new and enhanced.
      • PROC TEMPLATE
        SOURCE style
        DEFINE STYLE style-name; PARENT=parent;
        REPLACE fonts; 'FONT TYPE=(font_attribute(s))
        END; RUN:

        This procedure allows you to modify existing,
        or create new, table definitions [default templates] which can be used to
        control every aspect of reports. Such table definitions contain
        information on: column ordering, style information, cell formats, as well
        as other formatting characteristics.
        See SAS
        ONlineDOcs
        for more on this command and its syntax.


        Try this...

        proc template; source styles.printer; run;

        See what is written in the SAS LOG
        . You can take this code and modify
        it
        and save it with a new name [2 level names needed:
        Styles.mynewstyle].

    • TABULATE: enhancements related to style information.
        Also see under ODS HTML for STYLE= information on attributes.

        TO change Use Style=on
        class headings CLASS statement
        Keyword headings KEYWORD statement
        Box cell BOX= option
        Class level headings CLASSLEV statement
        Analysis variable headings VAR statement
        data cells PROC TABULATE statement
    • REPORT
        STYLE= option. See SAS
        ONlineDOcs
        for more on this command and its syntax.

     

     
     
     

    IX. SAS help

     

    • ONLINE DOCS
      A full installation V8 SAS ONLINE DOCS is available from a Server
      Services installation or an ACCC lab at:


      N:\SAS\SASOnlineDocV8\sasdoc\sashtml\onldoc.htm

      NOTE: SAS installation prefers Internet Explorer 5 for
      viewing the ONLINE DOCS help system. If you click the URL above and the
      left pane does not open with an index with 4 tabs,
      try opening this file with Internet Explorer instead of Netscape.

    • SAS System Help

      Exercise:

        Use the SAS SYSTEM HELP and find the following...

      • Syntax for PROC TABULATE.
      • An example for the PROC TABULATE.
      • Summary of System Options for Windows.
      • Converting User-Written Informats from Earlier Releases to Version 8.
      • GCHART procedure.

      Note that some of the information above is available via the web at:

    • What's
      New in SAS Software for Version 8
    • What's
      New in SAS Software for Release 8.1

     

     
     
     

    X. Code for most Exercises

     

      libname ddir "d:\sasdata\";
      libname dat8 "d:\sasdata\data";
      libname dat6 V612 "d:\sasdata\data";
      libname dat (dat8,dat6);
      
      data; set ddir.ex1; run;
      
      ods trace on /label;
      proc univariate; 
      var quantity amount;
      run;
      proc print; run;
      
      ods trace off;
      
      ods show;
      ods listing select BasicMeasure;
      ods listing show;
      
      /* ------ putting out one file with basic measure in it */
      ods listing close;
      ods output BasicMeasures=ddir.bmeasure;
      proc univariate; 
      var quantity amount;
      run;
      ods output close;
      ods listing;
      /* ---- ods html -- */
      ods listing close;
      ods proclabel 'My first sas HTML file!';
      ods html path='d:\sasdata\' (url=none) body='newfile.html'
      contents='contents.html' 
      page='page.html' frame='frame.html' style=brick};
      proc univariate;
      title 'This is my new title in purple
      and times';
      var quantity amount;
      run;
      ods html close;
      
      ods listing close;
      ods html path='d:\sasdata\' (url=none) body='newfile2.html';
      proc tabulate style={background=pink foreground=blue font_face=simplex
      font_weight=bold};
      title 'This is using Proc tabulate';
      class region saletype citysize product; 
      var quantity amount pop;
      tables region, saletype, citysize
      /style={background=red foreground=blue font_face=courier
      font_weight=bold};
      run;
      ods html close;
      ods listing;
      

     

     
     
     

    Where else can I go for more information?