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
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.