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 (July 2003, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Wed, 2 Jul 2003 13:02:00 -0700
Reply-To:   Prasad S Ravi <prasad.s.ravi@HOUSEHOLD.COM>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Prasad S Ravi <prasad.s.ravi@HOUSEHOLD.COM>
Subject:   Re: proc sql
Content-type:   text/plain; charset=us-ascii

proc sql; select patid, min(date) as min_date, min(your_other_var) as min_other_var ..... from dataset where target is not missing or target2 is not missing group by patid order by patid; quit; run;

Prasad Ravi

Kristie Beth <kristie_35_89@YAHOO. To: SAS-L@LISTSERV.UGA.EDU COM> cc: Sent by: "SAS(r) Subject: proc sql Discussion" <SAS-L@LISTSERV.UGA.E DU>

07/02/2003 11:45 AM Please respond to Kristie Beth

Hi, I have another question (thanks so much for the other help!), this is on proc sql, I am not understanding why or HOW the 'case when' works

For example, if I have the following code,

proc sql, select patid, case when target is not missing then min(date)

from dataset where target is not missing or target2 is not missing group by patid order by patid quit;

What I want to get is the min. date when the variable target is not missing but this code I have written doesn't achieve this. What's wrong? Also, I am trying to get the minimum of multiple variables, not just one but all have the condition of where target is not missing OR target2 is not missing.

I have read the documentation thru and thru on proc sql but still, the conditional statements seem to a problem...

thanks, Kristie

--------------------------------- Do you Yahoo!? The New Yahoo! Search - Faster. Easier. Bingo.


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