Date: Mon, 11 Sep 2000 12:29:45 -0700 "Lund, Pete" "SAS(r) Discussion" "Lund, Pete" Re: Counting and subsetting question To: Jack Shoemaker text/plain; charset="iso-8859-1"

Jack, How about this - the first step just sets up some sample data that matches yours:

** Set up sample data **;

data test; do i = 1 to 57; network = '01'; output; end; do i = 1 to 14; network = '02'; output; end; do i = 1 to 29; network = '03'; output; end; run;

proc sort; by network; run;

** Calculate groups of 20 or less **;

data groups; set test; by network;

retain group network_count 0;

if first.network or network_count eq 20 then do; group ++ 1; network_count = 0; end;

network_count ++ 1;

output; run;

proc freq; tables network*group / list; run;

---------------------------------------------------------------------- Pete Lund WA State Caseload Forecast Council 515 15th Ave SE Olympia, WA 98504-0962 (360) 902-0086 voice (360) 902-0084 fax (360) 971-0962 pager peter.lund@cfc.wa.gov ----------------------------------------------------------------------

-----Original Message----- From: Jack Shoemaker [mailto:JShoemaker@ACCORDANT.NET] Sent: Monday, September 11, 2000 12:01 PM To: SAS-L@LISTSERV.UGA.EDU Subject: Counting and subsetting question

Dear SAS-L,

I have a set of 100 people each with an attribute called network. The distribution of these people is

Network Count ======= ===== 01 57 02 14 03 29

I'd like to break these people into groups of no more than twenty, but have each group start on a new network boundary. For example,

Network Group Count ======= ===== ===== 01 1 20 01 2 20 01 3 17 02 4 14 03 5 20 03 6 9

I though this was easy until I tried to show someone else how to do this. Can one of you experts take me to school? TIA - Jack -- Jack N Shoemaker / JShoemaker@Accordant.net Visit our patient communities at http://www.accordant.com or our corporate site http://www.accordant.net

Back to: Top of message | Previous page | Main SAS-L page