![]() Chapter Contents |
![]() Previous |
![]() Next |
| VARLEN |
| Category: | SAS File I/O |
| Syntax | |
| Arguments | |
| Comparisons | |
| Examples | |
| See Also |
Syntax |
| VARLEN(data-set-id,var-num) |
| 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. |
| Comparisons |
VLENGTH returns the compile-time (allocated) size of the given variable.
| Examples |
%let dsid=%sysfunc(open(mydata,i));
%if &dsid %then
%do;
%let len=%sysfunc(varlen(&dsid,
%sysfunc(varnum
(&dsid,ADDRESS))));
%let rc=%sysfunc(close(&dsid));
%end;
data vars;
length name $ 8 type $ 1;
drop dsid i num rc;
dsid=open("mydata","i");
num=attrn(dsid,"nvars");
do i=1 to num;
name=varname(dsid,i);
type=vartype(dsid,i);
length=varlen(dsid,i);
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.