|
Irin,
Then couldn't you just first run a "proc sort nodupkey" to get rid of the
records that you don't want?
Art
-------
On Tue, 3 Feb 2009 06:07:22 -0800, Irin later <irinfigvam@YAHOO.COM> wrote:
>Arthur,
>The thing is that within the same id, desEAse and response� criteria I
need to count just those with the different resp_date.
>HOWEVER i also�do need�those patients� who have just one record
(therefore I do need CK)
>
>I DO NOT NEED THOSE� with the same resp-date (even if they have the same
response).
>�
>Thank you! I
>Irin
>
>
>--- On Mon, 2/2/09, Arthur Tabachneck <art297@NETSCAPE.NET> wrote:
>
>From: Arthur Tabachneck <art297@NETSCAPE.NET>
>Subject: Re: SQL count based on the certain criteria
>To: SAS-L@LISTSERV.UGA.EDU, "SUBSCRIBE SAS-L Irin Ros"
<irinfigvam@YAHOO.COM>
>Date: Monday, February 2, 2009, 6:58 PM
>
>Irin,
>
>I'm not sure if I correctly understand the problem. Does the following
>come close?:
>
>data have;
> input id $ disease $ response rep_date mmddyy10.;
> cards;
>10jan DM 1 08/10/2007
>10ian DM 1 12/02/2007
>10ian DM 2 12/02/2007
>10ian DM 3 12/02/2007
>10ian HF 1 12/02/2007
>12mar DM 2 12/03/2008
>12mar DM 2 07/03/2008
>34kat HF 2 11/01/2007
>34kat HF 3 10/02/2007
>45HAT CK 4 9/07/2008
>;
>
>proc sql;
> create table want as
> select id,disease,response,count(*) as count
> from have
> where disease ne 'CK'
> group by id,disease,response
>;
>quit;
>
>Art
>--------
>On Mon, 2 Feb 2009 15:40:04 -0800, Irin later <irinfigvam@YAHOO.COM>
>wrote:
>
>>I have a dataset health with id, disease , response , rep_date fields.
>>I need to know how many records within each id & certain disease have
>the
>same responses under different dates rep_dates:
>>For example:
>>id????? disease?? response??? rep-date
>>10jan?? DM??????? 1??????????? 08/10/2007
>>10ian?? DM??????? 1??????????? 12/02/2007
>>10ian?? DM??????? 2??????????? 12/02/2007
>>10ian?? DM??????? 3??????????? 12/02/2007
>>10ian?? HF??????? 1??????????? 12/02/2007
>>12mar?? DM??????? 2??????????? 12/03/2008
>>12mar?? DM??????? 2??????????? 07/03/2008
>>34kat?? HF??????? 2??????????? 11/01/2007
>>34kat?? HF??????? 3??????????? 10/02/2007
>>45HAT?? CK??????? 4??????????? 9/07/2008
>>?
>>My concern is the? combinations of the same ID, disease , RESPONSE'S
>value and "only" records? (like id=45HAT10jan)?
>>Based on the file I am going to do Proc Freq a Frequency with a count of
>records of the same id, disease to create something like the? following
>format report:
>>?
>>For DM:
>>REC-CNT??????? RESPONSE VALUE???????????????? FREQ
>>1??????????????????? 1????????????????????????????????????????????? 220
>>???????????????????? ?2????????????????????????????????????????????? 30
>>???????????????????? ?3???????????????????????????????????????????? ?48
>>????????????????????? .??????????????? .
>>??????
>>2?????????????????? 1????????????????????????????????????????????? 300
>>???????????????????? 3??????????????????????????????????????????? ? 22
>>???????????????????? 5????????????????????????????????????????????? 2???
>>
>>
>>For HF:.........????????? .
>>?How can I implement it in PROC SQL code? Could you please give me a
hand?
>>Thank you in advance,
>>Irin
>
|