Chapter Contents

Previous

Next
LVARLEVEL

LVARLEVEL



Fills an SCL list with the unique values of a column from a SAS table

Category: List


Syntax
Details
Examples
Example 1: Placing Values in the Current List
Example 2: Placing Values in a Specified List
See Also

Syntax

rc=LVARLEVEL(dsid,varname,n-level<,list-id>);

rc
contains the return code for the operation:
0 successful
[ne]0 not successful

Type: Numeric

dsid
is the identifier that was assigned when the table was opened. An invalid dsid produces an error condition.

Type: Numeric

varname
is the column whose unique formatted values are to be reported.

Type: Character

n-level
is the name of the column in which the function stores the number of unique values, or levels. This column must be initialized to a nonmissing value before its value is set by LVARLEVEL.

Note:   This parameter is an update parameter. See Input, Output, and Update Parameters for more information.  [cautionend]

Type: Numeric

list-id
is the identifier of the list to fill with the unique formatted values. If list-id is not provided, the values are placed in the current result list. An invalid list-id produces an error condition.

Type: Numeric or List


Details

The values are placed in the list identified by list-id, or in the current result list identified by CURLIST (if list-id is not specified). The values placed in the list are always character values. It is an error if list-id is omitted and you have not created a current result list with the CURLIST function. n-level must be a column, because LVARLEVEL uses it to store the number of unique values it finds. n-level must be initialized to any value except missing before LVARLEVEL executes.


Examples

Example 1: Placing Values in the Current List

Get the unique formatted values for the table column NAME from SASUSER.CLASS, place the values in the current list, and print them:

dsid=open('sasuser.class');
nlevels=0;
rc=curlist(makelist());
rc=lvarlevel(dsid,'name',nlevels);
put nlevels=;
call putlist(curlist(),'levels',0);
rc=close(dsid);

Example 2: Placing Values in a Specified List

Get the unique formatted values for the table column NAME from SASUSER.CLASS, place the values in the specified list, and print them:

dsid=open('sasuser.class');
nlevels=0;
listid=makelist();
rc=lvarlevel(dsid,'name',nlevels,listid);
put nlevels=;
call putlist(listid,'levels',0);
rc=close(dsid);
rc=dellist(listid);

See Also

CURLIST

OPEN

VARLEVEL

VARSTAT


Chapter Contents

Previous

Next

Top of Page

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