I have variables such as fac_tot30_outpatient and prof_tot30_outpatient, which I want to sum by id to create a tot30_outpatient variable. I wanted to know how to write a loop to do the below across multiple such categories of variables (tot30_carrier, tot30_intpatient, etc). I apologize for not using dataex, but I'm working of a remote server from which I can't copy. Many thanks.
Code:
egen tot30_outpatient=rowtotal(*tot30_outpatient) egen tot60_outpatient=rowtotal(*tot60_outpatient) egen tot90_outpatient=rowtotal(*tot90_outpatient) egen tot365_outpatient=rowtotal(*tot365_outpatient) egen tot30_inpatient=rowtotal(*tot30_inpatient) egen tot60_inpatient=rowtotal(*tot60_ipatient) egen tot90_inpatient=rowtotal(*tot90_inpatient) egen tot365_inpatient=rowtotal(*tot365_inpatient)
Karishma
0 Response to Adding variables with partial common names
Post a Comment