Chapter Contents |
Previous |
Next |
SAS SQL Query Window User's Guide |
This section contains examples for calling the QUERY, WHERE, and QWCLEXPR class methods from SAS Screen Control Language (SCL) along with possible returned error messages. The LOADCLASS and INSTANCE SCL functions only needed to be specified once.
QW_EDIT |
The following example invokes the Query Window with a user-defined profile, a preselected query included, and the confirmation end window turned off.
classid = loadclass('sashelp.sql.query.class'); objectid = instance(classid); querymsg = _blank_; call send(objectid, 'QW_EDIT', 'SASUSER.PROFILE.ORACLE ', ' ','SASUSER.PROFILE.SALES',' ','noend',querymsg); if ( querymsg not = _blank_ ) then _msg_ = querymsg;
QW_EDIT_INCLUDE |
The following example invokes the Query Window with the query SASUSER.PROFILE.SALES included.
classid = loadclass('sashelp.sql.query.class'); objectid = instance(classid); querymsg = _blank_; call send(objectid, 'QW_EDIT_INCLUDE', 'SASUSER.PROFILE.SALES', ' ',querymsg); if ( querymsg not = _blank_ ) then _msg_ = querymsg;
QW_EDIT_SELECTED |
The following example invokes the SQL Query Window with two tables, SASUSER.FITNESS and SASUSER.CLASS, selected, and begins in the SQL Query Column window.
clasid = loadclass('sashelp.sql.query.class'); objectid = instance(clasid); call send(objectid, 'QW_EDIT_SELECTED', 'SASUSER.FITNESS, SASUSER.CLASS');
QW_LIST_QUERIES |
The following example searches the SQL DICTIONARY.CATALOG rows for the SASUSER library and PROFILE catalog to find all catalog types of QUERY (saved SQL Query window queries). The name and description of the saved queries are stored in the SCL list QUERYLST with blanks between the name and the description.
classid = loadclass('sashelp.sql.query.class'); objectid = instance(classid); querymsg = _blank_; querylst = makelist(); call send(objectid, 'QW_LIST_QUERIES', 'SASUSER','PROFILE', querylst, querymsg); if ( querymsg not = _blank_ ) then _msg_ = querymsg;
QW_RUN |
The following example runs the query stored in SASUSER.PROFILE.SALES and displays results in the SAS Display Manager Output window without invoking the Query window.
classid = loadclass('sashelp.sql.query.class'); objectid = instance(classid); querymsg = _blank_; call send(objectid, 'QW_RUN', 'SASUSER.PROFILE.SALES', 'IMMEDIATE',' ',' ',querymsg); if ( querymsg not = _blank_ ) then _msg_ = querymsg;
The following example runs the query stored in SASUSER.PROFILE.SALES and displays results in the REPORT procedure window without invoking the Query window.
classid = loadclass('sashelp.sql.query.class'); objectid = instance(classid); querymsg = _blank_; call send(objectid, 'QW_RUN', 'SASUSER.PROFILE.SALES', ' ',' ',' ',querymsg)); if ( querymsg not = _blank_ ) then _msg_ = querymsg;
QW_EDIT_INCLUDE_RUN |
The following example runs the query stored in SASUSER.PROFILE.SALES, displays results in the REPORT procedure window, and invokes the Query window with this query included.
classid = loadclass('sashelp.sql.query.class'); objectid = instance(classid); querymsg = _blank_; call send(objectid, 'QW_EDIT_INCLUDE_RUN', 'SASUSER.PROFILE.SALES'); if ( querymsg not = _blank_ ) then _msg_ = querymsg;
WHERE_BLD |
The following example
builds SCL lists that contain available columns and column information from
the data set SASUSER.CRIME. The example invokes the WHERE expression window
titled
Record Subset
. This is independent of the SQL Query
Window.
classid = loadclass('sashelp.sql.qwwhere.class'); objectid = instance(classid); wherelst = makelist(); sqllist = makelist(); wheremsg = _blank_; call send(objectid, 'WHERE_BLD', sqllist, 'SASUSER.CRIME', wherelst, 'Record Subset', ' ', ' ', ' ', ' ', wheremsg); if ( wheremsg not = _blank_ ) then _msg_ = wheremsg;
The following example invokes the WHERE expression window and enables
the user to edit the last WHERE expression created and stored in SQLLIST.
The WHERE expression window is titled
Edit Record Subset
. This
is independent of the SQL Query Window.
classid = loadclass('sashelp.sql.qwwhere.class'); objectid = instance(classid); wheremsg = _blank_; call send(objectid, 'WHERE_BLD', sqllist, ' ', wherelst, 'Edit Record Subset', ' ', ' ', ' ', ' ', wheremsg); if ( wheremsg not = _blank_ ) then _msg_ = wheremsg;
GET_TEXT |
The following example creates a text array that contains an existing WHERE expression character string. The array can extend up to fifty 200-character-length segments. If any prompts were included in the WHERE expression, they are resolved by prompting the user to supply the values.
array textarray(50) $200; classid = loadclass('sashelp.sql.qwwhere.class'); objectid = instance(classid); wheremsg = _blank_; call send(objectid, 'GET_TEXT', sqllist, textarray, wheremsg); if ( wheremsg not = _blank_ ) then _msg_ = wheremsg;
GET_TEXT_LIST |
The following example builds an SCL list that contains the character string of an existing WHERE expression. If any prompts were included in the WHERE expression, they are resolved by prompting the user to supply the values.
classid = loadclass('sashelp.sql.qwwhere.class'); objectid = instance(classid); stringlst = makelist(); wheremsg = _blank_; call send(objectid, 'GET_TEXT_LIST', sqllist, stringlst); if ( wheremsg not = _blank_ ) then _msg_ = wheremsg;
WHERE_CLEAN |
The following example removes any SCL lists that are created and stored in SQLLIST for the WHERE expression window.
classid = loadclass('sashelp.sql.qwwhere.class'); objectid = instance(classid); call send(objectid, 'WHERE_CLEAN', sqllist);
EDIT_ADD_EXPR |
The following example invokes the COLUMN expression window to build the expression that will be named PRICEFT using the available columns from the data set SASUSER.HOUSES. PRICEFT will be added to EXPRMAST (expression master SCL list). This is independent of the SQL Query Window.
classid = loadclass('sashelp.sql.qwclexpr.class'); objectid = instance(classid); exprmast = makelist(); exprmsg = _blank_; call send(objectid, 'EDIT_ADD_EXPR', 'SASUSER.HOUSES', exprmast, 'PRICEFT',' ',' ',exprmsg); if ( exprmsg not = _blank_ ) then _msg_ = exprmsg;
The following example invokes the COLUMN expression window and allows the user to edit the expression named PRICEFT that was created and stored in EXPRMAST. This is independent of the SQL Query Window.
classid = loadclass('sashelp.sql.qwclexpr.class'); objectid = instance(classid); exprmast = makelist(); exprmsg = _blank_; call send(objectid, 'EDIT_ADD_EXPR', ' ', exprmast, 'PRICEFT',' ',' ',exprmsg); if ( exprmsg not = _blank_ ) then _msg_ = exprmsg;
GET_TEXT |
The following example creates a text array that contains the text string of the COLUMN expression named PRICEFT including format, label, and expression name. The array can extend up to fifty 200 character length segments.
array textarray(50) $200; classid = loadclass('sashelp.sql.qwclexpr.class'); objectid = instance(classid); call send(objectid, 'GET_TEXT', exprmast, textarray,'PRICEFT');
GET_TEXT_LIST |
The following example creates an SCL list that contains the text string of the COLUMN expression named PRICEFT including format, label and expression name.
classid = loadclass('sashelp.sql.qwclexpr.class'); objectid = instance(classid); stringlst = makelist(); call send(objectid, 'GET_TEXT_LIST', exprmast, stringlst,'PRICEFT');
GET_ATTRIB |
The following example extracts the attributes for the COLUMN expression named PRICEFT: format, data type, label and expression name.
classid = loadclass('sashelp.sql.qwclexpr.class'); objectid = instance(classid); type = _blank_; format = _blank_; label = _blank_; call send(objectid, 'GET_ATTRIB', exprmast, 'PRICEFT', type, format, label);
GET_VALUE_LIST |
The following example creates an SCL list that contains only the definition for the COLUMN expression named PRICEFT. The text string does not contain any of these column attributes: format, label and expression name.
classid = loadclass('sashelp.sql.qwclexpr.class'); objectid = instance(classid); stringlst = makelist(); call send(objectid, 'GET_VALUE_LIST', exprmast, stringlist, 'PRICEFT');
CLEAN_UP |
The following example removes the sublists created for the COLUMN expression named PRICEFT that were stored in EXPRMAST (expression master list).
classid = loadclass('sashelp.sql.qwclexpr.class'); objectid = instance(classid); call send(objectid, 'CLEAN_UP', exprmast, 'PRICEFT');
The following example removes all COLUMN expression sublists that were stored in EXPRMAST (expression master list).
classid = loadclass('sashelp.sql.qwclexpr.class'); objectid = instance(classid); call send(objectid, 'CLEAN_UP', exprmast, '_ALL_');
Chapter Contents |
Previous |
Next |
Top of Page |
Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.