if I have on the xaxis a list of years like 2001-2010 and I want to display for example between each year months 1-12 as interval. How can I do this? I used something like minor minorcount=12, which quiet displays the 12 ticks between the years but the plot isn't showing. Maybe am doing something wrong. Any help?
data have;
set sashelp.countseries;
format month_year mmyyn6.;
month_year=date;
where units in (0, 2, 3, 4);
run;
proc sgplot data=have;
scatter y=units x=month_year /markerattrs=(symbol=trianglefilled size=8 color=red );
xaxis label='years' values=(2004 to 2012 by 1) minor minorcount=12;
run;
For example if the value of month_year=042004. I will like the plot to start on the fourth minor tick between 2004 and 2005
You don't need to convert the 'date' variable to anything. PROC SGPLOT knows how to plot dates.
If you want major tick marks to indicate January, there are 11 minor tick marks (not 12) between the major ticks.
You can use the MIN= option on the XAXIS statement to specify the minimum value of an axis. For a date variable, you could use something like MIN='01Apr2004'd
data have;
set sashelp.countseries;
where units in (0, 2, 3, 4);
run;
proc sgplot data=have;
scatter y=units x=date /markerattrs=(symbol=trianglefilled size=8 color=red );
xaxis label='years' minor minorcount=11 min='01Apr2004'd;
run;
You don't need to convert the 'date' variable to anything. PROC SGPLOT knows how to plot dates.
If you want major tick marks to indicate January, there are 11 minor tick marks (not 12) between the major ticks.
You can use the MIN= option on the XAXIS statement to specify the minimum value of an axis. For a date variable, you could use something like MIN='01Apr2004'd
data have;
set sashelp.countseries;
where units in (0, 2, 3, 4);
run;
proc sgplot data=have;
scatter y=units x=date /markerattrs=(symbol=trianglefilled size=8 color=red );
xaxis label='years' minor minorcount=11 min='01Apr2004'd;
run;
SAS is headed back 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.
Interested in speaking? Content from our attendees is one of the reasons that makes SAS Innovate such a special event!
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.