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?
Forming portfolios and tracking their performanceDear Statalist members, I am new to Stata and would appreciate any help/insights you could give me,…
6-month Cumulative ReturnDear Statalists, I know there are couple of posts about cumulative returns but unfortunately none of…
Foreach regression loop - Stata 16Hi, I am trying the 'foreach' command for the first time and cannot figure out the problem in my cod…
Matching data with different time intervalsDear Statalist, For my research, I need to link accounting data with stock price data (both from WR…
Region dummies in fixed effects panel analysisHello, I am very new to both statalist and statistics in general, so I apologise in advance for my v…
Subscribe to:
Post Comments (Atom)
0 Response to simplify generate codes with loops always possible?
Post a Comment