Date: Wed, 7 Feb 1996 10:35:01 -0500
Reply-To: Christopher Zogby <chris@PHOR.COM>
Sender: "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From: Christopher Zogby <chris@PHOR.COM>
Organization: Pharmaceutical Outcomes Research, Inc.
Subject: Re: Counting the # of variables in a SAS dataset
In-Reply-To: <199602062049.PAA04466@ace.phor.com>
Sorry for the re-repost, but my last updated post could yield inaccurate
results if the last record of 'work.out' is not the greatest value of varnum.
A sort will fix that.
Corrected code below.
%macro numvars(dsn);
proc contents data=&dsn noprint out=out(keep=varnum);
run;
proc sort;
by varnum;
data _null_;
set out end=eof;
if eof then call symput('varnum',trim(varnum));
run;
%put &varnum=;
%mend numvars;
regards,
Chris
+*******************************************+
| Christopher Zogby |
| SAS Programmer/Analyst |
| Pharmaceutical Outcomes Research, Inc. |
| 435 Lawrence Bell Drive |
| Williamsville, NY 14221 |
| Phone: (716) 633-3463 |
| Fax: (716) 633-7404 |
| e-mail: chris@phor.com |
+*******************************************+
|