Hi all, I am trying to create a graph of weekly_count_visittype (Y axis) and week_num (X axis) separately for site. There are five sites in total, and each site has already its own label. What I am trying to do is to have the label (not numbers) of each site on the graph and in the file name when saved. What I've gotten so far is the values (1, 2, 3, etc) rather than "Colorado", "DHMC", "Michigan", etc. Any ideas how I can achieve this? Thank you very much for your help in advance!
lab def site_name 1 "Colorado" 2 "DHMC" 3 "Michigan" 4 "UCSF" 5 "UW"
lab val site_name site_name
levelsof site_name, local(levels)
foreach l of local levels {
line weekly_count_visittype week_num if visit_type==1 & site_name==`l'|| line weekly_count_visittype week_num if visit_type==2 & site_name==`l'|| line weekly_count_visittype week_num if visit_type==3 & site_name==`l', legend(label (1 "In-person") label(2 "Phone") label(3 "Video")) xlabel(0 (5) 85) ytitle("Visit type (#)") xtitle("Week number") title("`l'")
graph export "H:\...\visit_type_line_trend_byweek_`l'.png", replace
}
Related Posts with Using value labels in graphs through loops
Interpretation OLS residualHi, I don't know how interpret the OLS of residuals. There is my code : Code: *model 4 CD regress …
program mimrgns already defined (error occurred while loading MIMRGNS.ado)Hi Statalisters, I have mi data and I want to obtaing ajusted mean and CI after "mi estimate, post:…
skewed GARCHHello Statalist, I'm a Ph.D student and I'm currently working on my project, basically I'm trying to…
Is it okay to use lagged variable as my instrument when using control function?Hello, I am having a hard time dealing with endogeneity problems in my data, and recently I found a …
Generalized/Staggered DiD w/ state variationHello all, I'm considering running a generalize/staggered differences-in-differences model to analy…
Subscribe to:
Post Comments (Atom)
0 Response to Using value labels in graphs through loops
Post a Comment