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 (April 2007, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Tue, 3 Apr 2007 11:31:00 -0400
Reply-To:   "Sridhar, Nagakumar" <nagakumar.sridhar@SPCORP.COM>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   "Sridhar, Nagakumar" <nagakumar.sridhar@SPCORP.COM>
Subject:   Re: Data Step question
Comments:   To: "data _null_;" <datanull@GMAIL.COM>
In-Reply-To:   A<7367b4e20704030758q1c6d3dcev5e865f9b778ffd1a@mail.gmail.com>
Content-Type:   text/plain; charset="us-ascii"

Hi Data Null/Jake Bee: Thank you for your suggestion. That worked!! You are awesome!!

Regards

Kumar

-----Original Message----- From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of data _null_; Sent: Tuesday, April 03, 2007 10:58 AM To: SAS-L@LISTSERV.UGA.EDU Subject: Re: Data Step question

If I understand correctly then parhaps just setting some flags and then merging back to subset will work.

The SQL experts can show you how to do this in one step.

Data work.lab; input patno $5. visit 1. lo:6.2 hi:6.2 rslt:6.2; if not missing(rslt) then lowFlag = rslt lt lo; if not missing(rslt) then highLT10 = rslt gt hi and rslt lt 10; if not missing(rslt) then highGT10 = rslt gt 10; cards; 000011 .32 5.0000 0.20 000012 .32 5.0000 8.76 000013 .32 5.0000 95.50 000021 .32 5.0000 .24 000022 .32 5.0000 .31 000023 .32 5.0000 .33 ;;;; run; proc print; run; proc summary data=work.lab nway missing; class patno; var lowFlag highLT10 highGT10; output out=work.flags(drop=_:) max=; run; data work.labSubset; merge work.lab(drop=lowFlag high:) work.flags; by patno; if lowFlag and not(highLT10 or highGT10); run; proc print; run;

On 4/3/07, Sridhar, Nagakumar <nagakumar.sridhar@spcorp.com> wrote: > Hi All: > I am trying to do the following: > > I need to get data from a dataset that fulfills certain conditions. I

> need to make sure that if the a patient has low values in one visit > and high(er than the upper limit) values in the next, they (all values

> for that patient, regardless of whether they're lower or higher than the > lower/higher ranges) get grouped into one dataset. The problem is > that certain patients could have low values at one visit but very high

> values in the next visit. But, they also should meet certain criteria:

> These are: > > Lowest value < = lower limit of range (exclude those subjects > that then fit into the categories below) > Highest value > upper limit of range but less than 10 > Highest value > 10 > > Data have; /* JUST AN EXAMPLE OF WHAT THE DATA LOOKS LIKE. THERE ARE > ABOUT 3000 MORE PATIENTS*/ > input patno $5. visit 1. lo 6. 2 hi 6.2 rslt 6.2; > cards; > 000011 .32 5.0000 0.20 > 000012 .32 5.0000 8.76 > 000013 .32 5.0000 95.50 > 000021 .32 5.0000 .24 > 000022 .32 5.0000 .31 > 000023 .32 5.0000 .33 > ; > > What I need is: > > 000021 .32 5.0000 .24 > 000022 .32 5.0000 .31 > 000023 .32 5.0000 .33 > > > I hope I haven't confused you more than I usually do. > > TIA > > Kumar > > ********************************************************************* > This message and any attachments are solely for the > intended recipient. If you are not the intended recipient, disclosure,

> copying, use or distribution of the information included in this > message is prohibited -- Please immediately and permanently delete. > ********************************************************************* This message and any attachments are solely for the intended recipient. If you are not the intended recipient, disclosure, copying, use or distribution of the information included in this message is prohibited -- Please immediately and permanently delete.


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