Date: Thu, 19 Mar 2009 15:16:59 -0700
Reply-To: "Schwarz, Barry A" <barry.a.schwarz@BOEING.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Schwarz, Barry A" <barry.a.schwarz@BOEING.COM>
Subject: Re: LOCF question
In-Reply-To: <c155f35f-28ab-4dd2-9e9c-7fc93fab15a2@e38g2000yqa.googlegroups.com>
Content-Type: text/plain; charset="us-ascii"
Your rules don't cover the situations present in your sample:
Only visit 3
Only visit 4
Visits 1, 2, and 3
There are several other combinations which are not present in your
sample. We have no idea if these are possible or not.
After you have decided on the rules for all the possible combinations,
look up PROC SORT, the SET, BY, RETAIN and IF statements, and the LAST.
automatic variable in your reference.
-----Original Message-----
From: kasa
Sent: Thursday, March 19, 2009 2:52 PM
To: SAS-L@LISTSERV.UGA.EDU
Subject: LOCF question
I need to do LOCF (last observation carry forward).
If only visit1 is present for any parameter then there should not be
any additional observation for that particular parameter.
If only visit1 and visit2 is present then values for the visit3 and 4
should be carried forward to that parameter.
If only visit1 and visit3 are present then values for the visit4
should be carried forward from visit3 and
there should not be any observation for visit2.
If only visit1 and visit4 are present then there should not be any
observation for the visit2 and visit3.
Thanks for your answer in advance
have
Sub parameter visit value
101 1 1 89
101 1 2 198
101 1 3 78
101 2 1 165
101 3 3 198
102 1 1 143
102 1 4 148
102 2 1 156
102 2 2 186
102 3 4 196
I need
Sub parameter visit value locf
101 1 1 89
101 1 2 198
101 1 3 78
101 1 4 78 locf
101 2 1 165
101 3 3 198
101 3 4 198
102 1 1 143 locf
102 1 4 148
102 2 1 156
102 2 2 186
102 2 3 186
102 2 4 186 locf
102 3 4 196 locf