I asked a similar question earlier. I'm attempting to fill in missing values such that observations 0-458 are e 0, 445-832 are 1, and 832-850 are 0.
The following code allowed me to replace missing values in observations 1-160 with 1, with the rest of the observations set to 0.
replace myvar = cond(_n <= 160, 1, 0) if missing(myvar)
How can I interpret this command for my current purpose?
#This is cross-posted on StackOverflow here:https://stackoverflow.com/questions/...range-in-stata but so far with no luck.
Related Posts with How to recode missing values within a range in Stata
Testing measurement invariance across two groups/endless iterations when fitting the modelI am trying to test measurement invariance for a scale with 20 items loading 4 latent variables (no …
Advice for Imputing my Control VariablesHi everyone, I hope everything is well! I'm reaching out because I read some guidance on imputing b…
How to simulate data with specified ROC AUC and specified odds ratioI would like to do the following: 1- simulate 1000 observations 2 - simulate a continuous biomarker …
Category omitted from fixed effect when running regressionI am having a confusing problem -- when I ran my code last week, everything was normal. Now, not so …
Counting number of individuals (by sex and age) that answer a question in a longitudinal studyHello, I have a dataset with information of abuse (variable name: abused) at work by age and sex (v…
Subscribe to:
Post Comments (Atom)
0 Response to How to recode missing values within a range in Stata
Post a Comment