Date: Tue, 6 May 2003 21:58:58 -0700
Reply-To: "Huang, Ya" <yhuang@AMYLIN.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Huang, Ya" <yhuang@AMYLIN.COM>
Subject: Re: count then obs (was no subject)
Content-Type: text/plain; charset="iso-8859-1"
Kit,
This is the second time you post without a subject line recently.
Please remember to add a subject line to your message, so that people
won't miss it.
data xx;
input ZIPCODE $1-5 MSANAME $7-30 zip4 $32-35;
cards;
00016 Bakersfield, CA MSA 0001
00017 Fresno, CA MSA 0001
00010 N/A 0001
00011 N/A 0001
00012 N/A 0001
00019 N/A 0001
00014 Tucson, AZ MSA 0001
00015 Tucson, AZ MSA 0001
00018 Ventura, CA PMSA 0001
00028 Chico-Paradise, CA MSA 0002
00027 Colorado Springs, CO MSA 0002
;
options nocenter;
proc sql;
select distinct zip4,
sum(msaname^='N/A') as msa,
sum(msaname ='N/A') as na
from xx
group by zip4
;
--------------------
zip4 msa na
ffffffffffffffffffffffff
0001 5 4
0002 2 0
HTH
Ya
-----Original Message-----
From: Kit Leung [mailto:hello_joecool@HOTMAIL.COM]
Sent: Tuesday, May 06, 2003 7:09 PM
To: SAS-L@LISTSERV.UGA.EDU
Subject:
I was wondering is it possible to count how many n/a and non-n/a records
within the same 4-digit zipcode ?
ZIPCODE MSANAME zip4
00016 Bakersfield, CA MSA 0001
00017 Fresno, CA MSA 0001
00010 N/A 0001
00011 N/A 0001
00012 N/A 0001
00019 N/A 0001
00014 Tucson, AZ MSA 0001
00015 Tucson, AZ MSA 0001
00018 Ventura, CA PMSA 0001
00028 Chico-Paradise, CA MSA 0002
00027 Colorado Springs, CO MSA 0002
Basically, what I need is to come up a table like this:
zip4 MSA N/A
0001 5 4
0002 2 0
_________________________________________________________________
MSN 8 helps eliminate e-mail viruses. Get 2 months FREE*.
http://join.msn.com/?page=features/virus
|