Date: Sat, 14 Nov 2009 00:42:04 +0000
Reply-To: toby dunn <tobydunn@HOTMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: toby dunn <tobydunn@HOTMAIL.COM>
Subject: Re: Do Loops
Content-Type: text/plain; charset="iso-8859-1"
To answer your first question if I understand it correctly:
Data Have ;
Input ID TotalMonths ;
Data Need ;
Set Have ;
Retain Flag 1 ;
Do Month = 1 To TotalMonths ;
Data = Need NWay ;
Class Month ;
Output Out = CountsByMonth ( Drop = _Type_ _Freq_ )
Sum( Flag ) = Count ;
Data = CountsByMonth ;
Now I added ID variable for my benefit as well as the examples.
IF you need quarter as a possible variable and only want to count that person once in a quarter or multiple times in a quarter all can be accomplished in the do loop by controling when an observation is output'ed. It merely takes a little more work but not much. Then simply use the new variables in the Class statement of the Proc Summary.
"Don't bail. The best gold is at the bottom of barrels of crap."
"Be prepared. Luck is where preparation meets opportunity."
> Date: Fri, 13 Nov 2009 07:01:55 -0800
> From: nickcorbin0000@GOOGLEMAIL.COM
> Subject: Re: Do Loops
> To: SAS-L@LISTSERV.UGA.EDU
> thanks for all the responses on this.
> mark, i've been looking at your solution and it seems to give me what
> i want most efficiently. however, if i want to stratify 'quarter' by 2
> extra variables - say 'channel' and 'type' - how would i do this?
Windows 7: Unclutter your desktop.