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??
Related Posts with Filling a number of missing variables sharing prefix with "replace"
expand data?Dear All, I have this data set. Code: * Example generated by -dataex-. For more info, type help dat…
How to adjust the graph to fit the result board?Thanks to helps from other statalist member, I have the code to draw the graph based on the imported…
Finding the two binary variables most frequently equalling one together across a set of binary variablesHi I have a dataset in which the unit of analysis is individual citizens. I then have a large numbe…
Generate variable counting with conditionsHello everyone, Im having trouble findind the right command to do this, hope you can help me. I nee…
GMM: error with margins eyexDear Stata users, I am estimating the impact of income (lrgdp) on per capita carbon emissions(lpcca…
Subscribe to:
Post Comments (Atom)
0 Response to Filling a number of missing variables sharing prefix with "replace"
Post a Comment