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
How to use joinby to create a new panel dataDear community, I want to merge panel data for my master thesis, but my knowledge of econometrics i…
Adjusting for seasonality quarterly variable since 1950Hi all, This is my first post (so apologies if do not do everything right): I'm working with quarte…
Testing a specified regression modelDear Statalisters, Although I have been working with Stata for a few years now, I ran across a need…
separate time and dateHello everybody, how can I separate the date from the time ? Name of the variable is created_at. 2…
Create a dummy variable with a particular conditionHi everyone, I need some help with a code. I try to simplify. Let's consider 2 numeric variables (A…
Subscribe to:
Post Comments (Atom)
0 Response to Multiplying observations in a variable list
Post a Comment