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-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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