I am trying to insert a calculation into the plot statement in gbarline. I have code that successfully produces my stacked bars, but I cannot get the line to be a percentage. The datafile contains one record per observation, which seems to be necessary for the bars to stack correctly. Is it possible for the line to be a calculation?
I've tried putting the calculation into the plot stmt: plot / type=percent (flupos/pcr_count)
I've also tried putting the necessary denominator in the where statement as below.
proc gbarline data=six;
bar graphcode/ sumvar= ili
subgroup = subtype
FRAME MIDPOINTS=6 TO 58 BY 1
Just to be sure.
1) FLUPOS is a 0/1 var?
2) since you are doing a WHERE on ILI you would like the percent to be number of flu cases out of count within GRAPHCODE (across the SUBTYPE)?
3) check the specification of the PLOT statement (what version of SAS are you using).
FLUPOS is a 0/1 variable.
The "where ili=1 and pcr_count=1" statement should allow the denominator to be the number of records in the dataset. This would then plot the % flu positive, with stacked bars showing the tally of the flu positives by subgroup (the types of flu).
In the code below, my bar statement says "bar graphcode/sumvar=ili", which gives me a stack that inclues flu negatives as a part of the bar. However, I want the plot line to be limited only to the flu positives out of the # ili (oy, I hope that made sense).