Date: Tue, 15 Sep 2009 15:44:04 -0400
Reply-To: Sigurd Hermansen <HERMANS1@WESTAT.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Sigurd Hermansen <HERMANS1@WESTAT.COM>
Subject: Re: Summay Data by Proc Sql --- Easy Question. I think my braind
Content-Type: text/plain; charset="utf-8"
I'd say an easy question if you use PROC FREQ and know the correct parameter values, but not so easy in SAS SQL:
select distinct t1.ID as ID,t1.TYPE as TYPE, coalesce(t2.CNT,0) as CNT
from (select * from (select distinct ID from aa),(select distinct TYPE from aa)) as t1
(SELECT distinct ID,TYPE,COUNT(ID) as CNT
GROUP BY ID,TYPE
) as t2
on t1.ID=t2.ID and t1.TYPE=t2.TYPE
From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of pigpigpig
Sent: Tuesday, September 15, 2009 2:12 PM
Subject: Summay Data by Proc Sql --- Easy Question. I think my braind dies today
I think it should be a easy question. My brain dies today.
I have a dataset as follow:
There are totally 2 claim types.
input ID $2. +1 TYPE $3.;
PROC PRINT DATA=aa;
SELECT ID, TYPE, COUNT(ID) as CNT from aa
GROUP BY ID, TYPE;
The SAS System 09:20 Tuesday, September 15,
ID=00 doesn't have any claim type=LTR,
Is there a quick way to let the output also shows
By the way, I am hoping this can be done in one sql. I don't want
extra merge step or data step.