Hey guys,

I work with panal data in stata Version Stata/SE 16.1.

I want to do regressions in the years 2002,2007,2012 and 2017. I have the variable "decisonmaker" which isn't part of the questionnaire in the years I want to Rregress plus I've the typical problems with panal attrition. I decided I want to use the observation of "decisionmaker" which is closest to the given years.

I tried the following comand I found in this forum and tried to adjust it for my case but it didn't work and I don't really understood the last part.:

bysort ID (year) : ipolate decisionmaker year, gen (decisionmaker_new)
replace decisionmaker_new = cond(decisonmaker_new > 0; .; round(decisionmaker_new))

Stata points Outs that the function is unknown.

So I tried to substitut the last part, which I didn't understood, but stata pointed out that the name is Invalid. Note that this was just for a testing purpose and the variable isn't binary.

bysort ID (year) : ipolate decisionmaker year, gen (decisionmaker_new)
replace decisionmaker_new = cond(decisonmaker_new > 0; 1; 2)

What has to be in the brackets?

Thanks in advance

Ben

(I wasn't able to copy the Code because I'm sitting in the train for a few ours without wlan that why the Post looks a bit ugly )