Hello, I have a similar problem to the one 'aiste' posted. I tried following the code that worked for them, but it doesn't do what I want. Below is a print of the 27 obs. 'Code' and 'ctryno' identify countries. I want to fill in missing values for 'ihdi' with the previous one but only for the same value of 'code'. I understand that this can't be done for first.code (which is year 2010) if that value is missing, but Given the 2010 value of 'Ango', I want the 2011 value to be the same. Same for 2011-2013 for "Beli'. Here is my last code attempt. data four; set three; by ctryno year; retain _ihdi; if first.ctryno then call missing(_ihdi); if not missing(ihdi) then _ihdi=ihdi; else ihdi=_ihdi; run; Thanks in advance for any help.
... View more