Chapter Contents |
Previous |
Next |
VARNUM |
Category: | SAS File I/O |
Syntax | |
Arguments | |
Details | |
Examples | |
See Also |
Syntax |
VARNUM(data-set-id,var-name) |
Details |
VARNUM returns the number of a variable's position in a SAS data set, or 0 if the variable is not in the SAS data set. This is the same variable number that is next to the variable in the output from PROC CONTENTS.
Examples |
%let dsid=%sysfunc(open(city,i)); %let citynum=%sysfunc(varnum(&dsid,CITYNAME)); %let rc=%sysfunc(fetch(&dsid)); %let cityname=%sysfunc(getvarc (&dsid,&citynum));
data vars; length name $ 8 type $ 1 format informat $ 10 label $ 40; drop dsid i num rc; dsid=open("sasuser.houses","i"); num=attrn(dsid,"nvars"); do i=1 to num; name=varname(dsid,i); type=vartype(dsid,i); format=varfmt(dsid,i); informat=varinfmt(dsid,i); label=varlabel(dsid,i); length=varlen(dsid,i); position=varnum(dsid,name); output; end; rc=close(dsid); run;
See Also |
Functions:
|
Chapter Contents |
Previous |
Next |
Top of Page |
Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.