Note that there are some explanatory texts on larger screens.

plurals
  1. POBar Graph by Month - SAS EG
    primarykey
    data
    text
    <p>I am trying to create a bar graph in SAS Enterprise Guide. The graph is Savings by Month. The input Data is </p> <pre><code>Ref Date Savings A 03JUN2013 1000 A 08JUN2013 2000 A 08JUL2013 1500 A 08AUG2013 300 A 08NOV2013 100 B 09DEC2012 500 B 09MAY2013 400 B 19MAY2013 5999 B 09OCT2013 511 C 15OCT2013 1200 C 01NOV2013 1500 </code></pre> <p>The first step I do is to convert the date into month. The I use PROC MEANS to calculate total savings by month by Ref. Then I create a bar graph. The issue I am getting is the bar graph is not in a sequential order as it should be. Like it is AUG13 JUl13 JUN13 .. etc. instead of JUN JUL AUG.</p> <pre><code>PROC SQL; CREATE TABLE SAVINGS_11 AS SELECT PUT(DATE,monname3.) AS MONTH, (DATE) FORMAT=MONNAME3. AS MONTH1, MONTH(DATE) AS MONTH2, PUT(DATE,MONYY5.) AS MONTH3, (DATE) FORMAT=MONYY5. AS MONTH4, DATE, REF, SAVINGS FROM INPUT; QUIT; /* ------------------------------------------------------------------- Sort data set ------------------------------------------------------------------- */ PROC SORT DATA=SAVINGS_11(KEEP=SAVINGS MONTH MONTH1 MONTH2 MONTH3 MONTH4 REF) OUT=SORT1; BY REF; RUN; /* ------------------------------------------------------------------- Run the Means Procedure ------------------------------------------------------------------- */ TITLE; TITLE1 "Summary"; TITLE2 "Results"; FOOTNOTE; PROC MEANS DATA=SORT1 NOPRINT CHARTYPE NOLABELS NWAY SUM NONOBS ; VAR SAVINGS; CLASS MONTH / ORDER=DATA ASCENDING; BY REF; ID MONTH1 MONTH2 MONTH3 MONTH4; OUTPUT OUT=MEANSUMMARY SUM()= / AUTONAME AUTOLABEL WAYS INHERIT ; RUN; /* ------------------------------------------------------------------- End of task code. ------------------------------------------------------------------- */ RUN; QUIT; TITLE; FOOTNOTE; PROC SORT DATA=MEANSUMMARY(KEEP=MONTH MONTH2 "SAVINGS_Sum"n REF) OUT=SORT2 ; BY REF MONTH2; RUN; Axis1 STYLE=1 WIDTH=1 MINOR=NONE ; Axis2 STYLE=1 WIDTH=1 ; TITLE; TITLE1 "Bar Chart"; FOOTNOTE; PROC GCHART DATA=SORT2 ; VBAR MONTH / SUMVAR="SAVINGS_Sum"n CLIPREF FRAME LEVELS=ALL TYPE=SUM INSIDE=SUM COUTLINE=BLACK RAXIS=AXIS1 MAXIS=AXIS2 ; BY REF; /* ------------------------------------------------------------------- End of task code. ------------------------------------------------------------------- */ RUN; QUIT; TITLE; FOOTNOTE; </code></pre> <p>Whatever format I use, the end result is not in a sequential order. Please help.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload