LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (September 2000, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Mon, 11 Sep 2000 12:29:45 -0700
Reply-To:   "Lund, Pete" <Peter.Lund@CFC.WA.GOV>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   "Lund, Pete" <Peter.Lund@CFC.WA.GOV>
Subject:   Re: Counting and subsetting question
Comments:   To: Jack Shoemaker <JShoemaker@ACCORDANT.NET>
Content-Type:   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