Functions and CALL Routines |
Returns the label that is assigned to a SAS data
set variable.
VARLABEL(data-set-id,var-num)
|
-
data-set-id
-
specifies the data set identifier that the
OPEN function returns.
-
var-num
-
specifies the number of the variable's position
in the SAS data set.
Tip: |
This number is next to the
variable in the list that is produced by the CONTENTS procedure. |
Tip: |
The VARNUM function returns
this number. |
If no label has been assigned to the variable,
a blank string is returned.
VLABEL returns the label that is associated with the given variable.
This example obtains the label of the variable NAME
in the SAS data set MYDATA.
Obtaining the Label of the Variable NAME
%let dsid=%sysfunc(open(mydata,i));
%if &dsid %then
%do;
%let fmt=%sysfunc(varlabel(&dsid,
%sysfunc(varnum
(&dsid,NAME))));
%let rc=%sysfunc(close(&dsid));
%end;
Copyright © 2011 by SAS Institute Inc., Cary, NC, USA. All rights reserved.