Date: Mon, 14 Sep 2009 15:40:01 -0400
Reply-To: Arthur Tabachneck <art297@NETSCAPE.NET>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Arthur Tabachneck <art297@NETSCAPE.NET>
Subject: Re: replace
Bobs,
Such's code doesn't account for between object differences. Do you just
need for all weights to be steadily increasing or should that be dependent
upon object?
If it is dependent, then I'd suggest using ifn. e.g.:
data weight;
set weight1;
by object;
weight=ifn(first.object,weight,
ifn(weight lt lag(weight),lag(weight),weight));
run;
Also, your example shows the following result for 2 of the records:
from:
>75 RC 428 PVE 709
>75 RC 428 P24 700
to:
>75 RC 428 PVE 700
>75 RC 428 P24 709
Was that just a typo?
Art
--------
On Sun, 13 Sep 2009 20:25:15 -0700, Bobs <fabianezte@GMAIL.COM> wrote:
>Hi all SAS experts,
>
>my date is below.
>
>DATA weight1;
>INPUT object trat$ age type weight;
>DATALINES;
>6 NI 181 PD 390
>6 NI 253 P12 400
>6 NI 294 P18 300
>6 NI 283 PVE 684
>6 NI 324 PVS 698
>75 RC 428 PVE 709
>75 RC 428 P24 700
>75 RC 474 PVS 809
>75 RC 497 PVP 994
>75 RC 483 PVD 1258
>
>Proc print; data= weight1; run;
>
>Have a following weight by objects over time. However these weights
>must be growing. How to replace the weights for the minor and major by
>objetc and trat
>
>Example:
>DATA weight2;
>INPUT object trat$ age type weight;
>DATALINES;
>6 NI 181 PD 390
>6 NI 253 P12 400
>6 NI 294 P18 400
>6 NI 283 PVE 684
>6 NI 324 PVS 698
>75 RC 428 PVE 700
>75 RC 428 P24 709
>75 RC 474 PVS 809
>75 RC 497 PVP 994
>75 RC 483 PVD 1258
>
>Proc print; data= weight2; run;
>
>Thanks and regards