Chapter Contents

Previous

Next
SAS/ACCESS Software for Relational Databases: Reference

Reviewing Variables

Before retrieving or updating DBMS data that is described by a view descriptor, you might want to review the attributes of the data's variables. You can use the CONTENTS or DATASETS procedure to display a view descriptor's variable and format information. You can use these procedures with view descriptors in the same way that you use them with other SAS data sets.

This example uses the DATASETS procedure to display information about the view descriptor VLIB.USACUST, which describes the data in the DB2 table SASDEMO.CUSTOMERS.

options linesize=80;

proc access dbms=db2;
/* create access descriptor  */ 
   create adlib.customr.access;
   table=sasdemo.customers;
   ssid=db2;
   assign=yes;
   rename customer=custnum
          firstorder=firstord;
   format firstorder date9.;
   list all;

/* create vlib.usacust view */
   create vlib.usacust.view;
   select customer state zipcode name
          firstorder;
   subset where customer like '1%';
run;

/* example             */
proc datasets library=vlib memtype=view;
   contents data=usacust;
run;

Using the DATASETS Procedure with a View Descriptor shows the results of this example.

Using the DATASETS Procedure with a View Descriptor
                               DATASETS PROCEDURE

         Data Set Name: VLIB.USACUST          Observations:         .
         Member Type:   VIEW                  Variables:            5
         Engine:        DB2                   Indexes:              0
         Created:       .                     Observation Length:   0
         Last Modified: .                     Deleted Observations: 0
         Protection:                          Compressed:           NO
         Data Set Type:                       Sorted:               NO
         Label:

             -----Alphabetic List of Variables and Attributes-----

    #    Variable    Type    Len    Pos    Format    Informat    Label
    -----------------------------------------------------------------------
    1    CUSTNUM     Char      8      0    $8.       $8.         CUSTOMER
    5    FIRSTORD    Num       8     88    DATE9.    DATE9.      FIRSTORDER
    4    NAME        Char     60     24    $60.      $60.        NAME
    2    STATE       Char      2      8    $2.       $2.         STATE
    3    ZIPCODE     Char      5     16    $5.       $5.         ZIPCODE

In the DATASETS procedure output, the VLIB.USACUST view descriptor has five variables: CUSTNUM, FIRSTORD, NAME, STATE, and ZIPCODE. The variables are listed in alphabetic order, and the # column in the listing shows the order of each variable in VLIB.USACUST. The Label field in the DATASETS procedure lists the complete names of the DBMS columns. Note that descriptors do not support SAS names longer than eight characters.

The information displayed by the DATASETS procedure does not include any selection criteria that might be specified for the view descriptor. To see selection criteria, you must review the code that created the view descriptor.

You can use the ACCESS procedure's UPDATE statement to change the attributes of a view descriptor. See ACCESS Procedure Syntax for more information.


Chapter Contents

Previous

Next

Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.