I am using the following codes. would it be possible for me to simplify these and make them shorter. I am always getting the advice to write shortest codes but sometimes i feel it is not possible.
gen are = S2_Q2AK * S2_Q2BK
gen ki = S2_Q3AK * S2_Q3BK
gen pre = S2_Q2AP * S2_Q2BP
gen cul = S2_Q3AP * S2_Q3BP
gen dek = S2_Q2D * S2_Q2BD
gen wat = S2_Q3AD * S2_Q3BD
egen own = rowtotal ( are pre dek)
egen cul = rowtotal (ki cul wat)
Thank you in advance for all the advice i have received here. it has been so helpful with university all closing and having limited access to computer labs.
Related Posts with simplify generate codes with loops always possible?
fine gray models stcrregHi all, I'm interested in the impact of orthostatic hypotension on incident dementia. I did a cox m…
estat vif after reghdfeHi, In a regression I'm running using reghdfe with two way fixed effects and two way clustering, on…
Command subinstr doesn't work to remove space in number stringHi Statalist, I have this data set: Code: * Example generated by -dataex-. To install: ssc install…
Prefix ‘by’ when running post-estimation statistics for a PCAHi I have a question regarding the use of the prefix ‘by’ when running post-estimation statistics fo…
🐛 Stata inserts ESC as a character into inputI've been looking for a way to reproduce this since about the times of Stata 10, and finally today f…
Subscribe to:
Post Comments (Atom)
0 Response to simplify generate codes with loops always possible?
Post a Comment