BookmarkSubscribeRSS Feed
deleted_user
Not applicable
If this is the data set in excel i can create vertical barchart with A and B in Different Colour for Particular year alone. Is that possible to Make in SAS also. I tried in Proc Gchart.I need more clarity on this can one help me out.

A B
1981 12 13
1982 15 19
1983 16 20
1984 25 16
1985 23 32


Example Chart(Display Like this):
l
l
l
l
l A B
l A B
l A B A B
l A B A B
l A B A B
l--A-B---A-B--------------
1981 1982

Thanks in Advance
4 REPLIES 4
deleted_user
Not applicable
Sorry for the Worst Chart Example (display)
Olivier
Pyrite | Level 9
I think that what you are looking for is either the GROUP option or the SUBGROUP option in the GCHART procedure. If I understand correctly your example, this should rather be GROUP (side-by-side bars for A and B, correct guess ?).
But you should transform your data first. Instead of :
YEAR A B
1981 12 13
1982 15 19
1983 16 20
1984 25 16
1985 23 32

you should use :
YEAR _NAME_ COL1
1981 A 12
1981 B 13
1982 A 15
1982 B 19
etc.

You can easily do so using the TRANSPOSE procedure :
PROC TRANSPOSE DATA = dataIn OUT = dataOut ;
VAR a b ;
BY year ;
RUN ;

Then apply to the new dataset :
PROC GCHART DATA = dataOut ;
VBAR year / DISCRETE GROUP = _name_ SUMVAR = col1 ;
RUN ; QUIT ;
deleted_user
Not applicable
I got it but, If A and B combined together of the year 1982 and so on., Rite now it shows the separete display for A and B.

Thanks in advance.
Olivier
Pyrite | Level 9
Sorry, just swap between YEAR and _NAME_ in the previous program : VBAR _name_ / GROUP = year ...

Is that correct, this time ?

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

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!

Register now

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 1527 views
  • 0 likes
  • 2 in conversation