Help using Base SAS procedures

Proc Gchart

Reply
Frequent Contributor
Posts: 99

Proc Gchart

Hi,
Thanks for the help.

I am trying to create a vertical stacked column chart using gghart. the subgroup variable 'type' has 2 values A and B. I want B to be on top of stack and A on bottom. Basically I want to control order of stacking.

Data;
input year type amount;
2005 A 1000
2005 B 35
2006 A 345
2006 B 500

Thanks,

Amit
Super Contributor
Posts: 273

Re: Proc Gchart

Amit
A way to understand
[pre]
Data z;
input year type $ amount;
cards;
2005 A 1000
2005 B 35
2006 A 345
2006 B 500
;
run;
proc format ;
value $t "A" = "top A"
"B" = "bottom B"
;
value $inv "A" = "bottom A"
"B" = "top B"
;
run;
proc gchart data=z ;
vbar year/discrete subgroup=type sumvar=amount;
format type $t.;
run;
quit;
proc gchart data=z ;
vbar year/discrete subgroup=type sumvar=amount;
format type $inv.;
run;
quit;

[/pre]
Frequent Contributor
Posts: 99

Re: Proc Gchart

Thanks a lot. This is what I was looking for.

Can you tell me why it works. Is it because of the alphabets order. Bottom comes before top.

Thanks,

Amit
Ask a Question
Discussion stats
  • 2 replies
  • 143 views
  • 0 likes
  • 2 in conversation