I often find I want to make my generic Stata code suit the specifics of my dataset/output.
So, in the example below, I want to replace the generic word "outcome" (and all compound words containing the word "outcome") with a more specific word like "colon_cc":
...and so on.
Currently I use the "find and replace" function in MS Word to do this! (I'm sure many Stata users would regard this as a sin, but I'm still very much learning.)
Any advice would be greatly appreciated!
With regards
So, in the example below, I want to replace the generic word "outcome" (and all compound words containing the word "outcome") with a more specific word like "colon_cc":
Code:
gen outcome1 = 0 replace outcome1 = 1 if icd >= "C180" & icd <= "C188" gen outcome2 = 0 replace outcome2 = 1 if icd == "C189" gen outcome_grp = 0 replace outcome_grp = 1 if outcome1 == 1 | outcome2 == 1 stset exit, fail(outcome1) enter(entry) origin(entry) id(sysno) stcox i.exposure i.other_vars regsave 1.exposure using "dir\results.dta", ci pval addlabel(description, outcome1) append stset exit, fail(outcome2) enter(entry) origin(entry) id(sysno) stcox i.exposure i.other_vars regsave 1.exposure using "dir\results.dta", ci pval addlabel(description, outcome2) append stset exit, fail(outcome_grp) enter(entry) origin(entry) id(sysno) stcox i.exposure i.other_vars regsave 1.exposure using "dir\results.dta", ci pval addlabel(description, outcome_grp) append
Currently I use the "find and replace" function in MS Word to do this! (I'm sure many Stata users would regard this as a sin, but I'm still very much learning.)
Any advice would be greatly appreciated!
With regards
Comment