BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
brokenpc1
Fluorite | Level 6

Hi there,

 

I would like to plot a series of revenue data on quarter and year using proc sgplot. The data I have is like the following:

 

YearQuarterRevenue
2020Q14,215
 Q24,868
 Q37,520
 Q47,045
2021Q16,653
 Q29,113
 Q34,676
 Q42,933
2022Q13,701
 Q23,692
 Q33,721
 Q45,478

 

In Excel, I can make a series like the following:

 

chart.png

 

However, I can't figure out how to make X axis having quarter and year using proc sgplot like it did in Excel. Any tricks here please?

 

Thank you.

1 ACCEPTED SOLUTION
4 REPLIES 4
DanH_sas
SAS Super FREQ

Here is one way:

proc sgpanel data=sashelp.prdsale;
panelby year / layout=columnlattice noheaderborder colheaderpos=bottom novarname;
colaxis display=(nolabel) values=(1 2 3 4) valuesdisplay=("Q1" "Q2" "Q3" "Q4");
vline quarter / response=actual markers;
run;

In your case, you have Q1-Q4 in your data instead of 1-4, so you can drop the VALUES and VALUESDISPLAY option.

 

Hope this helps!

Dan 

brokenpc1
Fluorite | Level 6

Thank you all for answering my question! I think @Ksharp 's answer is most relevant to my situation, although I still don't know how to put year under months, but yeah, it's almost there.  

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
  • 539 views
  • 1 like
  • 4 in conversation