Reputation: 7618
I have the following table :
WEIGHT DATE 1/1/11 1/2/11 1/3/11 ... 1/12/11
NAME
NICK 70 kg . 72kg .
JOHN 60 kg 63 kg . 60 kg
MIKE 50kg 51kg 50kg .
BOB 75kg . . .
...
And I would like to fill in the missing values '.' with the previsous declaration .
For example for NICK I would get :
WEIGHT DATE 1/1/11 1/2/11 1/3/11 ... 1/12/11
NAME
NICK 70 kg 70kg 72kg 72kg
I'm pretty new to sas and I don't have a clue on how to do it. For the time being, my idea would be to use a proc IML to read each line as an array and work on it, but I've never used such a proc.
thanks for your help
Upvotes: 0
Views: 437
Reputation: 2388
You don't need PROC IML. You can do this with arrays and the first and last statements and probably a lag statement as well.
I am not expert on the data step, but searching SAS-L will find something. I know this problem has been solved by Ron Cody in his book on Longitudinal Data in SAS, but I don't have access to that book right now.
Upvotes: 1