In a dataset of multiple variable lists, I would like to multiply the value of only selected variables in one variable list by 4. Namely, I want to keep the observations unchaged if the observation concerns the age_group of <1 years and 95 plus (age_group variable list is not numeric). For all the other cases, I am trying to multiply the observation values by 4. I initially used this command: gen new_var = old_var * 4 if age_group != "<1 year" but I cannot incorporate 95 plus age group in this command. Also, in a new variable list, observations for <1 age group are deleted, while I would just like to keep the previous value. Thanks!
Related Posts with Multiplying observations in a variable list
Merging observations into one variableI am working with survey data. Respondents are given the option to respond in different units for so…
Reshaping data from wide to long, creating new j variableHi, UGENT HELP PLEASE I need to reshape my data from wide too long in order to merge it with alrea…
Graph bar -Hi everyone, I'm making a graph for a variable with three categories that resembles the following: …
Graph bar - Centering one graph when using -by()-Hi everyone, I'm making a graph for a variable with three categories that resembles the following: …
bsample result not robust after innocuous data manipulation?Hi Stata users, Currently I found the bsample is not returning robust results after some seemingly …
Subscribe to:
Post Comments (Atom)
0 Response to Multiplying observations in a variable list
Post a Comment