Hi,
If my dataset looks like this, what would be my category data for this? (this is just fiction)
I want to have (I have two dataset, I want to compare two periods) stacked columns diagram and I'm using this code:
/* Merge the calculated datasets for each period */
data merged_data;
merge calc_period1 (rename=(ECL_stage1=ECL_stage1_1 ECL_stage2=ECL_stage2_1 ECL_stage3=ECL_stage3_1))
calc_period2 (rename=(ECL_stage1=ECL_stage1_2 ECL_stage2=ECL_stage2_2 ECL_stage3=ECL_stage3_2));
run;
/* Stacked column chart */
proc sgplot data=merged_data;
vbar category / response=ECL_stage1_1 group=period1 groupdisplay=stacked barwidth=0.4;
vbar category / response=ECL_stage2_1 group=period1 groupdisplay=stacked barwidth=0.4;
vbar category / response=ECL_stage3_1 group=period1 groupdisplay=stacked barwidth=0.4;
vbar category / response=ECL_stage1_2 group=period2 groupdisplay=stacked barwidth=0.4 barattrs=(color=lightgray);
vbar category / response=ECL_stage2_2 group=period2 groupdisplay=stacked barwidth=0.4 barattrs=(color=lightgray);
vbar category / response=ECL_stage3_2 group=period2 groupdisplay=stacked barwidth=0.4 barattrs=(color=lightgray);
yaxis label="ECL (in millions)";
xaxis discreteorder=data;
keylegend / location=inside position=topright across=1;
run;
but I don't know what what my category variable would be.
I don't know how to edit my thread, but the whole looks like this
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.