SAS Component Language Dictionary |
Category: | SAS Table |
Syntax | |
Details | |
Examples | |
Example 1: Working with Several Tables | |
Example 2: Returning the DSID of a Generation Data Set | |
See Also |
Syntax |
dsid=DSID(<table-name<,mode<,nth<,gen-num>>>>); |
contains either the identifier for the table, or
0 |
if the table is not currently open, if the table is not open in the requested mode, or if no nth open occurrence exists. |
<0 |
names the SAS table to search for. The default is _LAST_, which is the last table that was created in the current SAS session. A one-level name is assumed to be a SAS table name in the default SAS data library, WORK. A two-level name is assumed to be libref.table.
specifies whether to limit the search to tables that are open in one of the modes listed below. If mode is not specified, DSID returns the dsid for the first occurrence of table-name that is open in any mode. Values for mode are
OPEN.specifies which occurrence of table-name opened in the specified mode to search for. By default, the search returns the first occurrence.
is the generation number of the SAS table for which the DSID is returned.
Details |
DSID searches all SAS tables that are currently open. This function is useful for accessing table identifiers across entries.
Examples |
Open several SAS tables and find the first occurrence in various modes:
/* Open several SAS tables, varying the open mode */ dsid1 = open('sasuser.class', 'I'); dsid2 = open('sasuser.class', 'U'); dsid3 = open('sasuser.class', 'U'); dsid4 = open('sasuser.houses', 'U'); dsid5 = open('sasuser.class', 'I'); dsid6 = open('sasuser.houses', 'U'); dsid7 = open('sasuser.houses', 'I'); dsid8 = open('sasuser.class', 'U'); /* Find the first occurrence open in any mode.*/ first = DSID( 'sasuser.houses' ); put first=; /* Find the first occurrence open in 'I' */ firstI = DSID( 'sasuser.houses', 'I' ); put firstI=; /* Find the second occurrence open in 'I' */ secondI = DSID( 'sasuser.class', 'I', 2 ); put second=; /* Return the fourth occurrence open in 'U' */ secondU = DSID( 'sasuser.class', 'U', 4 ); put secondU=;
This example produces the following output:
first=4 firstI=7 secondI=5 secondU=0
The following code returns the DSID of the SAS table WORK.ONE#003.
dsid=DSID(`work.one',`IN',1,3);
See Also |
Copyright © 2009 by SAS Institute Inc., Cary, NC, USA. All rights reserved.