Chapter Contents

Previous

Next
SAS Data File: _getMembers

SAS Data File: _getMembers



Conditionally retrieves a list of variables for a SAS Data File object


Syntax
_getMembers List Items
Details
Examples
Example 1: Select-Exclude lists
Example 2: Item Masks
Example 3: Creating an Object and Retrieving Information
See Also

Syntax

CALL SEND (datafile-object-id, '_getMembers', members-list<, select-exclude><, item-mask><, 'APPEND'>);

Argument Type Description
members-list
N specifies the identifier of an SCL list. Each entry in members-list corresponds to a SAS data file variable and is a sublist containing the items in Table 1. Specify members-list as a numeric variable that is initialized either to 0 or to a valid list identifier. If the value of members-list is 0, then, _getMembers creates a new list, fills it with the members of the SAS Data File object, and returns the list identifier. If members-list is a nonzero, then it must be a valid list identifer; otherwise, the program halts wih an error.
select-exclude
C specifies the entries that are returned in members-list. Use this form:
<item-name='item-values'
...<item-name-n='item-values'>>


The select-exclude argument contains one or more blank-separated select-exclude expressions where item-name is one of the item names from members-list, and item-values is a blank-separated string of possible values for the given item name. To exclude entries with a certain value for an item-name, precede that value with a "not" character, for example "^" or "¬" in the select-exclude expression.
item-mask
C specifies the named items that are included in each entry of members-list. The item-mask argument is a blank separated string of the item names from members-list. To exclude an item from each entry of members-list, precede it with a "not" character, for example "^" or "¬".
'APPEND'
C appends any members entries to members-list; without 'APPEND', members-list is cleared.

_getMembers List Items
List item Type Description
DATAFILE C the name of the SAS data file that is associated with the SAS Data File object
NAME C the name of the nth variable in datafile-object-id
TYPE C the variable type of NAME, "C" for character or "N" for numeric
LABEL C the label of NAME
FORMAT C the format of NAME
INFORMAT C the informat of NAME
LENGTH N the length of NAME


Details

_getMembers and _loadMembers perform the same function except _getMembers enables you to select the variables that are loaded.

By default, _getMembers clears all items from members-list and fills it with the SAS Data File object members. If 'APPEND' is specified, the SAS Data File object members are appended to the existing members-list. The conditions defined by the select-exclude, item-mask, and options arguments determine the items that are returned in the list.


Examples

Example 1: Select-Exclude lists

The following call to _getMembers returns all variables in the SAS Data File object, DATAFILE, that are of type character.

varlist=makelist();
call send (dfile, "_get_members_", varlist, 
           "type='c'");

The following call to _getMembers returns all variables in the SAS Data File object, DATAFILE, except AGE and NAME:

call send (dfile, "_get_members_", varlist,
           "name='^age ^name'");

Example 2: Item Masks

The following call to _getMembers returns a list of variables from the SAS Data File object, DATAFILE, whose entries include the named items NAME, TYPE and LENGTH:

call send (dfile, '_get_members_', varlist,
           "", "name type length");

The following call to _getMembers returns a list of variables from the SAS Data File object, DATAFILE, whose entries include all item names except for FORMAT and INFORMAT:

call send (dfile, '_get_members_', varlist,
           "", "^format ^informat");

Example 3: Creating an Object and Retrieving Information

This example creates an object for the SAS data file SASUSER.FITNESS and then retrieves information for all variables in SASUSER.FITNESS except those of type numeric. Each entry in VARLIST contains the NAME, LABEL, FORMAT, INFORMAT and LENGTH items:

call send (dfile, '_get_members_', varlist,
           "type='^n'", 'name label format 
           informat length');

See Also

_loadMembers.


Chapter Contents

Previous

Next

Top of Page

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