Hi Statalisters,

I've merged two datasets which are cross-sectional(year of 2004) and time series(year from 2012-2015) with student id.
Because the variables from those two are different, I should fill the missing values in the rest 4 years with the number in year 2004.

Searching Statalist, I found the following code to fill the BYAID for 2012-2015 with 2004.

bysort BYSID (BYAID) : replace BYAID = BYAID[_n-1] if missing(BYAID)

However, there are a bunch of other variables starting with BYA#, BYT#, FY#... (# means series of numbers).

I've tried with the following code,

bysort BYSID (BYA*) : replace BYA* = BYA*[_n-1] if missing(BYA*)

But there was error message : BYA ambiguous abbreviation

How could I fill all the missing variable with these prefix, without error??