Hello there. This is probably something ridiculously simple. I am trying to replace missing data points within multiple series with a new value generated off the last year's growth rate. So if I am missing 2014q3 I take the growth rate from 2013q2-2013q3 and use that to interpolate the 2014q3 value. I am trying to use the code below, but I think that I am referencing the series wrong. I want it to check through and if there is no NA leave the series as is, but if there is an NA fill the NA with a value calculated as mentioned above. I also tried to use the second code, but to no avail. The second code I would also have to put into a for statement for all of the states, I was just testing if it would work for Ohio. Thanks! Edit: The first one gives the error message "NA found in matrix in "IF NGPIND{%X} = NA THEN" in testfill.prg.
Code: Select all
%states = "AK AL AR AZ CA CO CT DC DE FL GA HI IA ID IL IN KS KY LA MA MD ME MI MN MO MS MT NC ND NE NH NJ NM NV NY OH OK OR PA RI SC SD TN TX UT VA VT WA WI WV WY"
for %x {%states}
if ngpind{%x} = na then
series ngpind{%x} = ((ngpind{%x}(-4)-ngpind{%x}(-5))/ngpind{%x}(-5))*ngpind{%x}
else
ngpind{%x}=ngpind{%x}
endif
next
Code: Select all
series ngpindoh = @nan(ngpindoh, ((ngpindoh(-4)-ngpindoh(-5))/ngpindoh(-5))*ngpindoh)