Hi, I am trying to do something seemingly basic but surprisingly complicated - to plot the levels of multiple categorical variables as stacked bars in a single graph. The purpose is to depict the proportion of patients that had vs. did not have a given blood test done before, during, after their hospitalization.
I would like to plot a stacked bar graph with the x-axis containing 3 stacked bars side-by-side (one for each variable, representing the different time points) and the y-axis containing the count or percent of each response stacked (0 or 1). I've tried tabplot, catplot, graph bar, twoway bar, ... but can't seem to figure it out.
Thank you for your help,
Jonathan
Code:
* Generate flag for done / not done
foreach var of varlist lab_cholesterol_before lab_cholesterol_during lab_cholesterol_after{
gen `var'_done = 1 if !missing(`var')
replace `var'_done = 0 if missing(`var')
}
Thank you for your help,
Jonathan

Comment