I'm sure this is a function but I'm having trouble finding it --
I'm trying to make a loop that behaves differently for each observation depending on the value for one of the variables.
I have this command right now,
Code:
foreach f in Allergy_Envir Allergy_Skin Allergy_Other Asthma Psoriasis Thyroiditis T1Diabetes Uveitis DownSyndrome{ egen `f'_sensitivity = rowtotal(ind_`f'_w1 - ind_`f'_w5) if start_of_symptoms == 5
I was trying to do this,
Code:
foreach f in Allergy_Envir Allergy_Skin Allergy_Other Asthma Psoriasis Thyroiditis T1Diabetes Uveitis DownSyndrome{ foreach w in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21{ replace `f'_sensitivity = rowtotal(ind_`f'_w1 - ind_`f'_w`w') if start_of_symptoms == `w'
Is there an easy way to set this up?
Thank you,
Jon
0 Response to Specifying a 'fill in the blank' variable in a loop
Post a Comment