Chapter Contents

Previous

Next
SAS/ACCESS Software for PC File Formats: Reference

Reviewing Variables

Before retrieving or updating the PC files data that are described by a view descriptor, you may 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 much the same way 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 CUSTOMERS.WK3 file.

options linesize=80;

proc access dbms=wk3;
   create adlib.customr.access;         
   /* create access descriptor  */
   path="c:\sasdemo\customer.wk3";
   worksheet=a;
   range='a1..j22';
   getnames=yes;
   scantype=5;
   mixed=yes;
   assign=yes;
   rename customer = custnum;
   format firstorder date9.;
   list all;

   create vlib.usacust.view;           
   /* create vlib.usacust view */
   select customer state zipcode name
          firstorder;
run;

proc datasets library=vlib memtype=view;   
   /* example             */
   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:         21
         Member Type:   VIEW                  Variables:            5
         Engine:        SASIOWK3              Indexes:              0
         Created:       .                     Observation Length:   83
         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     75    DATE9.    DATE9.      FIRSTORDER
    4    NAME        Char     60     15    $60.      $60.        NAME
    2    STATE       Char      2      8    $2.       $2.         STATE
    3    ZIPCODE     Char      5     10    $5.       $5.         ZIPCODE

As you can see from 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 names of the PC files columns. The FIRSTORDER column name has been truncated to the eight-character SAS variable name FIRSTORD because the SAS System uses only the first eight characters of a PC files column name when it assigns a default SAS variable name. See ASSIGN for more information about how SAS variable names are assigned for PC files column names.

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 cannot use the MODIFY statement in the DATASETS procedure to change the attributes of a view descriptor.

For more information about the DATASETS procedure, see SAS Procedures Guide.


Chapter Contents

Previous

Next

Top of Page

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