BookmarkSubscribeRSS Feed
VijayKumar
Calcite | Level 5

Hello Experts,

Need your suggestions/help for the problem I am facing.

Here is the dataset, the code and the current output:

Dataset:

PeriodAmountChange
31/03/071003.5
30/06/071103
30/09/0711610
31/12/071254
31/03/081183.2
30/06/081283
30/09/081353.5
31/12/081404
31/03/091452
30/06/0915312
30/09/091301.5
31/12/091351
31/03/101201.5
30/06/101402
30/09/101521
31/12/101642
31/03/111751.5
30/06/1118015
30/09/111882
31/12/111951.7

CODE:

/*****************************************************/
symbol1 value=dot height=0.25 interpol=join color=red;
axis1 minor=none label=(angle=90 "change") ;
axis3 minor=none label=("Year") ;
axis2 minor=none label=(angle=270 color=red "amount") value=(color=red);

proc gbarline data=GBARLIN1;
      bar period / discrete type=mean  sumvar=change raxis=axis1 maxis=axis3 inside=mean width=8 space=4;
      plot/sumvar=amount axis=axis2;
      format period year4.;
      format change 4.1;
      format amount 3.;
      run;
quit;
/*****************************************************/

Current OUTPUT:

gbarline_plotissue.JPG

The issues are:

1) For the plot , I needed the amount to be plotted and not their SUM or MEAN...That is no statistics...How do I achieve this?

2) Can I plot all the values on the line (i.e., all the quarter values)  not just values at midpoint?  (that is the bars will be yearly mean of one of the

variable(change) while plot should be representing the exact value of the other variable (amount) for all the quarters (but no mean/sum) )

Thanks!

3 REPLIES 3
VijayKumar
Calcite | Level 5

Hello Experts,

Please help me with your suggestions!!Smiley Sad

-VK

ballardw
Super User

The reason your periods are grouped is the use of : Foramat period year4.; which is telling SAS to group and display by year. Use YYQ6. YYQS8. or similar.

If the data is already summarized as it appears in your case the choice of statistic doesn't matter but the procedure does expect to have a statistic. I think with the format change above you'll get what you're looking for.

VijayKumar
Calcite | Level 5

Thanks Ballard for you reply. Your explanation is correct!

But, I have used YEAR4. because I want yearly average per BAR...

and for the plot I wanted all the points plotted.  But the problem is that the plot is plotting at midpoints only. Is there some trick to have plot display all the values?

In short, for BAR... it should group while for PLOT it should not group.


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
  • 3 replies
  • 497 views
  • 0 likes
  • 2 in conversation