Chapter Contents


SAS/ACCESS Software for Relational Databases: Reference

Charting Data

This example shows two ways to use the GCHART procedure with DBMS data. The first method uses descriptors. The second method uses the new SAS/ACCESS LIBNAME statement to accomplish the same task in an easier and more direct way. Note that descriptor names and variables are still limited to eight characters, but the LIBNAME statement accommodates member names and variable names up to 32 characters.

Using the GCHART Procedure with Descriptors

The following example uses the view descriptor VLIB.ALLORDR to create a vertical bar chart of the number of orders per product. VLIB.ALLORDR describes the data in the Oracle Rdb table ORDERS.

proc access dbms=rdb;

/* create access descriptor    */

   create adlib.order.access;
   rename dateorderd = dateord
          processdby = procesby;
   format dateorderd    datetime9.
          shipped       datetime9.
          ordernum      5.0
          length        4.0
          stocknum      4.0
          takenby       6.0
          processdby    6.0
          fabcharges    12.2;
   list all;

/* create vlib.allordr view descriptor */

   create vlib.allordr.view;
   select all;

proc gchart data=vlib.allordr;
   vbar stocknum / discrete;
title 'Data Described by VLIB.ALLORDER';
Output for both of these examples is shown in Output from PROC GCHART. STOCKNUM represents each product. The number of orders for each product is represented by the height of the bar. (In some operating environments, the increments on the vertical axis may be different.)

Using the GCHART Procedure with a SAS/ACCESS LIBNAME

This example uses the SQL and GCHART procedures to chart data from the PROC SQL view WORK.ALLORDR, created from the ORACLE table ORDERS. This example differs from the previous example in that the SAS/ACCESS LIBNAME statement is used to define a SAS libref that references DBMS data. Descriptors are not used. Output from this example is identical to the previous example, except for the column names, which are limited to eight characters when you use descriptors but can be up to 32 characters when you use the SAS/ACCESS LIBNAME statement.

libname myoralib oracle user=dmitry pass=elvis
  path='txtdata' schema=textile;

proc gchart data=myoralib,orders;
  vbar stocknum / discrete;
  title 'Data Described by VLIB.ALLORDER';

Output from PROC GCHART


Chapter Contents



Top of Page

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