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 (August 2008, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Mon, 4 Aug 2008 19:32:37 -0400
Reply-To:     SAS_learner <proccontents@GMAIL.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         SAS_learner <proccontents@GMAIL.COM>
Subject:      Re: Count function in PROC SQL
Comments: To: Kitty Lee <kit_lee2008@yahoo.com>
In-Reply-To:  <622163.7463.qm@web46004.mail.sp1.yahoo.com>
Content-Type: text/plain; charset=ISO-8859-1

hello lee , Is this what u are looking for

data test; input name $2. Type $2. zipcode zip3 ; datalines ; A N 12345 123 B N 12345 123 C P 22222 222 D P 33333 333 E P 44444 444 F P 55555 555 G P 12355 123 K P 22225 222 ; Run;

proc sql noprint ; create table test_1 as select *, count(type) as type_count From test group by zipcode; Quit ;

Let me know if the result does not match or what exactly u want

thanks

On Mon, Aug 4, 2008 at 7:03 PM, Kitty Lee <kit_lee2008@yahoo.com> wrote:

> Hi All, > I have a question on counting by type and zip3 (the first 3 digit of a > zipcode) level. I think PROC SQL is probably the best way to count but I am > not too familiar with SQL. > The following is my rawdata. Basically, I would like to count how many > names at zip3 level by type. > e..g. > Zip3 = 123 would have 2 Ns and 1P > Zip3 = 222 would have 0Ns and 2Ps etc... > Any ideas would help. Thank you very much!! > zipcode name Type zip3 > 12345 A N 123 > 12345 B N 123 > 22222 C P 222 > 33333 D P 333 > 44444 E P 444 > 55555 F P 555 > 12355 G P 123 > 22225 K P 222 > > >


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