Chapter Contents |
Previous |
Next |
VARFMT |
Category: | SAS File I/O |
Syntax | |
Arguments | |
Details | |
Examples | |
See Also |
Syntax |
VARFMT(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. |
Details |
If no format has been assigned to the variable, a blank string is returned.
Examples |
%let dsid=%sysfunc(open(mydata,i)); %if &dsid %then %do; %let fmt=%sysfunc(varfmt(&dsid, %sysfunc(varnum (&dsid,NAME)))); %let rc=%sysfunc(close(&dsid)); %end;
data vars; length name $ 8 content $ 12; drop dsid i num rc fmt; dsid=open("mydata","i"); num=attrn(dsid,"nvars"); do while (fetch(dsid)=0); do i=1 to num; name=varname(dsid,i); if (vartype(dsid,i)='N') then do; fmt=varfmt(dsid,i); if fmt='' then fmt="BEST12."; content=putc(putn(getvarn (dsid,i),fmt),"$char12."); output; end; end; 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.