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"
Greatest lower bound and other alternatives to Cronbach's alphaHello everyone, What are the stata commands for glb (greatest lower bound) for estimating internal …
How can I create a lagged 4 year max variable?The relevant column in my dataset are "gvkey" (a group id), datadate (ex. YYYYMMDD = 20100531), and …
Forvalue loop in self-design bootstrapI am a beginning learner of Mata, and I came across a feedback of "break" when running the code belo…
Erase blank spaces from a twoway graphDear Statalist, I would like to create a graph (twoway scatter) using the by() option for some group…
Appropriate Dimension for Clustering of Standard ErrorsHi, I am trying to estimate the impact of directors' remuneration on firm performance. My unbalance…
Subscribe to:
Post Comments (Atom)
0 Response to Filling a number of missing variables sharing prefix with "replace"
Post a Comment