The SAS Output Delivery System and reporting techniques

Reg. CHART in SAS

Reply
N/A
Posts: 0

Reg. CHART in SAS

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
N/A
Posts: 0

Re: Reg. CHART in SAS

Posted in reply to deleted_user
Sorry for the Worst Chart Example (display)
Super Contributor
Posts: 260

Re: Reg. CHART in SAS

Posted in reply to deleted_user
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 ;
N/A
Posts: 0

Re: Reg. CHART in SAS

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.
Super Contributor
Posts: 260

Re: Reg. CHART in SAS

Posted in reply to deleted_user
Sorry, just swap between YEAR and _NAME_ in the previous program : VBAR _name_ / GROUP = year ...

Is that correct, this time ?
Ask a Question
Discussion stats
  • 4 replies
  • 159 views
  • 0 likes
  • 2 in conversation