Date: Wed, 3 Mar 2010 15:20:20 -0500
Reply-To: Jack Clark <jclark@HILLTOP.UMBC.EDU>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Jack Clark <jclark@HILLTOP.UMBC.EDU>
Subject: Re: A Data manipulation question - Confusing to me (Running out
of time) - May be Retian
In-Reply-To: A<B282BE35B5A4494894D4ECFBA2BF784715C0BE7DCE@XCH-NW-17V.nw.nos.boeing.com>
Content-Type: text/plain; charset="us-ascii"
Barry,
I think your solution requires the variable OUT to be added to the
RETAIN statement.
Jack
Jack Clark
Senior Research Analyst
phone: 410-455-6256
fax: 410-455-6850
jclark@hilltop.umbc.edu
University of Maryland, Baltimore County
Sondheim Hall, 3rd Floor
1000 Hilltop Circle
Baltimore, MD 21250
Confidentiality Notice: This e-mail may contain information that is legally privileged and that is intended only for the use of the addressee(s) named above. If you are not the intended recipient, you are hereby notified that any disclosure, copying of this e-mail, distribution, or action taken in reliance on the contents of this e-mail and/or documents attributed to this e-mail is strictly prohibited. If you have received this information in error, please notify the sender immediately by phone and delete this entire e-mail. Thank you.-----Original Message-----
From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of
Schwarz, Barry A
Sent: Wednesday, March 03, 2010 3:03 PM
To: SAS-L@LISTSERV.UGA.EDU
Subject: Re: A Data manipulation question - Confusing to me (Running out
of time) - May be Retian
data new (drop = problem save);
retain save;
set old;
if problem = 'pain' then
do;
save = dose;
out = 0;
end;
else if out = 0 then
do;
if dose < save then
out = 1;
else
out = -1;
end;
if out = 1;
run;
-----Original Message-----
From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Tom
Smith
Sent: Wednesday, March 03, 2010 11:09 AM
To: SAS-L@LISTSERV.UGA.EDU
Subject: A Data manipulation question - Confusing to me (Running out of
time) - May be Retian
I have a followwing dataset with variables -Problem,subject,
cycle, dose .
Problem subject cycle dose
------ ------- ----- ----
pain 1001 1 30
1001 2 30
1001 3 10
1001 4 20
1002 1 20
pain 1002 2 30
1002 3 20
1002 4 40
pain 1003 1 50
1003 2 20
1003 3 10
I need a dataset as below: if the variable "Problem" has a value
"pain" and the value of variable dose of next record is
less than the value of variable dose from the previous record
( previous record means -in which record the variable
'problem" has a value 'pain"), need all rest of the records
for that pateint.
subject cycle dose
------- ------ ------
1002 3 20
1002 4 40
1003 2 20
1003 3 10
Thanks you so much from bottom of my heart.