Hi teams, I am trying to set the x-axis on my chart to show only the date per seven days. However I want to keep the x-axis data shown on my chart to represent each day in my data set, which represents about 42 days (similar to the attached example). The main purpose is to not clutter the x-axis. I am not sure what function I need to have. Below is my script where I uses proc sgplot. I have also tried using proc gchart.
The source dataset is simple, witht 84 rows and three columns - Activity Date (Act_Date), Receipt_Count (integer), and Receipt_Code (string)
proc sgplot data=MY_DATA_SET; format Act_Date date6.; title 'Daily Chart for MY DATA SET';
If you want to control how many tick marks get labeled you can use the VALUES= option on the xaxis statement.
Xaxis values=('01JAN2020'd to '15FEB2020'd by week) ;
as an example. You supply the start and end dates you expect. The start is the more critical as that sets the first value to display and then the "by week" selects the remaining dates at 7 day intervals. The 'to' date just sets an upper likely limit if you happen to have data values for X that go past that date.
do x= '01Jan2020'd to '31Mar2020'd;
y= 50* rand('uniform');
proc sgplot data=example;
series x=x y=y;
format x date6.;
xaxis values=('03Jan2020'd to '15Feb2020'd by week);
You can use common calendar intervals such as week, month, quarter and year for by interval. This makes more sense if the xaxis variable is supposed to be a date.
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.