Hi all,
I have a numeric variable, range is about from 100-400,000. I would like to recode this variable to group it into ranges of 1,000.
For example:
gen newvar = .
replace newvar = 1 if var >=100 & <1000
However, this will take a lot of time. I understand that a macro might help but I have zero experience with macros. I would appreciate any help in this. Thank you.
Related Posts with Stata Recoding Variable Macro
Chow test statisticHi everyone! I tried doing a chow test using -test- and the following command: Code: . suest Brahmi…
Setting version, seed, and sortseed not sufficient for reproducibility?The following code appears to produce different results depending on the Stata 16.1 edition I use. …
MFX table logit commandHi all, I'm fairly new to Stata since I need it to write my bachelor thesis. However I'm stuck... I…
Clogit vs Xtlogit with FE vs Logit with Dummy VariablesHi, I have an unbalanced panel data of stocks with N=20,000 and T=50 years. I have 50 industries. I…
Create a new variable based on a date string variable yyyy-mm-dd and a numeric variable (yyyymmdd)Hi! I am very new to STATA. I have seen you answer different questions regarding date-variables. Ho…
Subscribe to:
Post Comments (Atom)
0 Response to Stata Recoding Variable Macro
Post a Comment