Chapter Contents

Previous

Next
SAS/ACCESS Interface to SYSTEM 2000 Data Management Software: Reference

Creating Descriptor Files

You define descriptor files with the ACCESS procedure. You can define access descriptor files and view descriptor files in the same PROC ACCESS execution or in separate executions. Within an execution, you can define multiple descriptor files of the same and different types.


Creating Access and View Descriptors in One PROC Step

Perhaps the most common way to use the ACCESS procedure statements, especially in batch mode, is to create an access descriptor and one or more view descriptors based on this access descriptor in a single PROC ACCESS execution. The following example shows how to do this. First, an access descriptor is created (MYLIB.EMPLOYE). Then two view descriptors are created (VLIB.EMPPOS and VLIB.EMPSKIL). Each statement is then explained in the order it appears in the example program.

proc access dbms=s2k;
   create mylib.employe.access;
      database=employee s2kpw=demo mode=multi;
      assign=yes;
      drop c110 c120;
      rename forename=firstnme office_e=phone
             yearsofe=years gender=sex
             degree_c=degree;
      length firstnme=13 lastname=13 c101=16;
      list all;

   create vlib.emppos.view;
      select lastname firstnme position departme 
         manager;
      subset "order by lastname";
      list all;

   create vlib.empskil.view;
      select c2 c3 c201 c203;
      subset "ob skilltyp";
      s2kpw=demo mode=multi;
      list view;
run;

Here is an explanation of the statements in this example:

proc access dbms=s2k;
invokes the ACCESS procedure for the SAS/ACCESS interface to SYSTEM 2000 software.

create mylib.employe.access;
identifies the access descriptor, MYLIB.EMPLOYE, that you want to create. The MYLIB libref must be associated with the SAS data library before you can specify it in this statement.

database=employee s2kpw=demo mode=multi;
indicates the access descriptor is for the EMPLOYEE database, specifies the password, DEMO, required to access the database definition, and indicates the database is in the Multi-User environment.

assign=yes;
generates unique SAS variable names based on the first eight non-blank characters of the item names. Variable names and attributes can be changed in this access descriptor but not in any view descriptors created from this access descriptor.

drop c110 c120;
marks the records associated with C-numbers C110 and C120 as non-display. Because these two C-numbers indicate records, all the items in each record are marked as non-display. Therefore, all the items in the two records associated with these numbers do not appear in any view descriptor created from this access descriptor.

rename forename=firstnme office_e=phone yearsofe=years gender=sex degree_c=degree;
renames the default SAS variable names associated with the FORENAME, OFFICE_E, YEARSOFE, GENDER, and DEGREE_C SAS names. Specify the default SAS variable name on the left side of the equal sign (=) and the new name on the right. Because the ASSIGN=YES statement is specified, any view descriptors created from this access descriptor automatically use the new SAS variable names.

length firstnme=13 lastname=13 c101=16;
changes the field width for the items associated with FIRSTNME and LASTNAME to 13 characters and the field width for the item associated with C-number C101 (the POSITION SAS name) to 16 characters.

list all;
lists the access descriptor's item identifier numbers, C-numbers, SAS variable names, SAS formats, SAS informats, and SAS variable lengths. The list includes any associated BY key information and is written to the SAS log. Any items that have been dropped from display (using the DROP statement) have *NON-DISPLAY* next to them.

create vlib.emppos.view;
writes the access descriptor to the library associated with MYLIB and identifies the view descriptor, VLIB.EMPPOS, that you want to create. The VLIB libref must be associated with a SAS data library before you can specify it in this statement.

select lastname firstnme position departme manager;
selects the items associated with the LASTNAME, FIRSTNME, POSITION, DEPARTME, and MANAGER SAS names for inclusion in the view descriptor. The SELECT statement is required to create the view unless a RENAME, FORMAT, INFORMAT, LENGTH, or BYKEY statement is specified.

subset "order by lastname";
specifies you want the names in the output to be ordered by last name. Using the word WHERE is optional. Use the SAS/ACCESS interface to SYSTEM 2000 syntax in the SUBSET statement.

list all;
lists all the available item identifier numbers, C-numbers, SAS variable names, SAS formats, SAS informats, and SAS variable lengths on which the view descriptor is based; items that have been dropped from the display have *NON-DISPLAY* next to them. Any associated BY key information is also listed. Selection criteria specified in the view descriptor are listed. Items that have been selected for the view have *SELECTED* next to them. The list is written to the SAS log.

create vlib.empskil.view;
writes the first view descriptor to the library associated with VLIB and identifies the next view descriptor, VLIB.EMPSKIL, that you want to create.

select c2 c3 c201 c203;
selects the four items associated with C-numbers C2, C3, C201 and C203 for inclusion in the view descriptor. The SELECT statement is required to create the view unless a RENAME, FORMAT, INFORMAT, LENGTH, or BYKEY statement is specified.

subset "ob skilltyp";
specifies you want the observations to be sorted by skill type. Refer to SUBSET for syntax information.

s2kpw=demo mode=multi;
specifies the password required to access the data and indicates the database is in the Multi-User environment. This information is stored in the view descriptor. To override this password, or to specify a SYSTEM 2000 password for view descriptor VLIB.EMPPOS, which omits the S2KPW statement, you can use the S2KPW data set option. For more information, see Data Set Options.

list view;
lists the item identifier numbers, the C-numbers, the SAS variable names, the SAS formats, the SAS informats, and the SAS variable lengths that have been selected for the view descriptor. Any associated BY key information is also listed. Selection criteria specified in the view descriptor are listed. The list is written to the SAS log.

run;
writes the last view descriptor when the RUN statement is processed.


Creating Access and View Descriptors in Separate PROC Steps

Examples of how to create the MYLIB.EMPLOYE access descriptor and VLIB.EMPOS and VLIB.EMPSKIL view descriptors in separate PROC ACCESS executions are provided in Example Data.

When you use a separate PROC ACCESS execution to create a view descriptor, note that you must use the ACCDESC= option to specify an existing access descriptor from which the view descriptor will be derived.


Chapter Contents

Previous

Next

Top of Page

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