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 (January 2008, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Tue, 22 Jan 2008 23:05:47 -0500
Reply-To:     Arthur Tabachneck <art297@NETSCAPE.NET>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Arthur Tabachneck <art297@NETSCAPE.NET>
Subject:      Re: Selecting pts with only cancer diagnosis
Comments: To: gopilth@YAHOO.COM

Gopi,

If, in your example, you want to identify patients 25 and 31, then something like the following will work:

data have; input pt diacod; cards; 11 200 11 120 11 120.2 20 220 20 120.1 20 120.9 31 120 22 217.9 22 120.8 22 542.9 25 120.6 25 120.9 25 120 ;

proc sort data=have; by pt; run;

data want (keep=pt); set have; retain hiv other; by pt; if first.pt then do; hiv=0; other=0; end; if diacod in (120,120.1,120.2,120.3,120.4,120.5, 120.6,120.7,120.8,120.9) then hiv=1; else other=1; if last.pt and hiv and not(other) then output; run;

If you don't like the above method, you could also use proc transpose, sql, arrays, or a hash.

HTH, Art ----------- On Tue, 22 Jan 2008 18:56:58 -0800, gopilth@YAHOO.COM wrote:

>Hi, >Iam trying to clean data for some analysis and want to select only the >patients who have HIV only and no other infectious disease based on >the diagnosis code.In other words I want pts with diagnosis code >120,120.1,120.2....120.9(all these codes are for hiv) and exclude >every person with a different diagnosis code as well as if they have >any other diagnosis code along with HIV diag code. The data set I have >is something like this. > >pt diacod >11 200 >11 120 >11 120.2 >20 220 >20 120.1 >20 120.9 >31 120 >22 217.9 >22 120.8 >22 542.9 >25 120.6 >25 120.9 >25 120 > >Thanks in advance. >Gopi. > >.


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