Dear all,
I want to supplement the current missing values using the values around it . Below is my code.
foreach x of varlist * {
qui bys id : replace `x'=`x'[_n-1] if missing(`x')
qui bys id : replace `x'=`x'[_n+1] if missing(`x')
}
but it seems not to work. Even I run this code a few times , there still exists missing value. Is there any command to do this job?
Related Posts with Missing values
How to randomly select control sample for the treatment sample multiple times and run regressions?Dear all, I am using Stata 14.0 to solve the questions about randomly selecting control sample for t…
How to generate 5 year-sum variables?Hello, I have been trying to generate a variable that takes the five-year sum (from t-4 to to year t…
Need some help on how to run multivariat tobit (mvtobit) in STATAI am engaging on a research and among the objectives measuring the status of rural household’s multi…
How to drop specific observations from dataset in Stata?Hello, I have a large dataset but I do not need all observations. The dataset contains data for eve…
Date problem. Again...Hi, I have read the documentation but I still do not understand why I can npt convert my string var…
Subscribe to:
Post Comments (Atom)
0 Response to Missing values
Post a Comment