Go Back   Rhinocerus > Newsgroup > Newsgroup comp.soft-sys.sas

Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old 11-02-2004, 03:02 PM
Ross, Michael D
Guest
 
Posts: n/a
Default Re: Global Count!

Thanks Toby.

One more question, I'm looking to put these "count" variables into one
dataset, so that I can report on them down the road. Is there a way to
accomplish this in the "freq" macro or do I need another macro?

I appreciate your help - Thanks!

Mike

-----Original Message-----
From: Dunn, Toby [mailto:Toby.Dunn@TEA.STATE.TX.US]
Sent: Monday, November 01, 2004 4:58 PM
To: SAS-L@LISTSERV.UGA.EDU
Subject: Re: Global Count!


Ross, try this:

%macro freq(path=,ds=) ;

%global countall ;

proc freq
data = &path..&ds noprint ;
tables trial/ out = &ds (keep = count rename=(count=count_&path.&ds))
;
run ;

%let countall = %eval(&countall + 1) ;

%mend freq ;

%freq(path=prior, ds=xxx) ;
%freq(path=prior, ds=yyy) ;


Should get you a count of the number of time the macro ran;

It won't however get you a count of the number of obs. in a dataset. To
do that you need to do the following:

data one ;
do x = 1 to 10 ;
Output ;
End ;
Run ;

proc sql ;
select nobs into : obs_cnt
from dictionary.tables
where memname = "ONE" ;
Quit ;

%put &nobs ;

Will get you the number of physical obs in a dataset.

Now what about the case where you might have marked some for deletion:

proc sql ;
select delobs into : obs_cnt
from dictionary.tables
where memname = "ONE" ;
Quit ;

%put &nobs ;

HTH
Toby Dunn

-----Original Message-----
From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of
Ross, Michael D
Sent: Monday, November 01, 2004 3:33 PM
To: SAS-L@LISTSERV.UGA.EDU
Subject: Global Count!


Hi All,
I need to get a count everytime through this macro, ending up with the
total number of times I went through it. Any suggestions?

Also, is this the best way to do counts? I need to count observations
in various datasets and present a report.

%macro freq(path=,ds=);
%global count ;
proc freq data = &path..&ds noprint;
tables trial/ out = &ds (keep = count
rename=(count=count_&path.&ds)) ;
run ;
%let &countall=&count+1;
%mend freq;

%freq(path=prior, ds=xxx);
%freq(path=prior, ds=yyy);
Reply With Quote
Alt Today
Advertising
 
and become member of Rhinocerus
Standard Sponsored Links

Reply

Popular Tags in the Forum
count, global

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Count Variables in different data sets Muthia Kachirayan Newsgroup comp.soft-sys.sas 0 11-07-2008 01:33 AM
Re: Global Count! House, Laura Newsgroup comp.soft-sys.sas 0 11-04-2004 08:39 PM
Re: Global Count! Jack Hamilton Newsgroup comp.soft-sys.sas 0 11-04-2004 05:39 PM
Re: Global Count! Sigurd Hermansen Newsgroup comp.soft-sys.sas 0 11-04-2004 03:48 PM
Re: Global Count! Dunn, Toby Newsgroup comp.soft-sys.sas 0 11-01-2004 08:57 PM



All times are GMT. The time now is 11:47 AM.


Copyright ©2009

LinkBacks Enabled by vBSEO 3.3.0 RC2 © 2009, Crawlability, Inc.