I am trying to change my x axis ticks, but every time I do it either lumps the data into the new ticks or drops all data on years with no tick instead of just changing the labels.
What is the correct way to change axis ticks without combining or losing my data?
This is what I have:
filename test1234 url "https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2021/2021-09-21/nominees.csv";
proc import out=nominees datafile=test1234 dbms=csv replace;
guessingrows = max;
run;
proc sgplot data=nominees;
where year > 1000;
vbar year / group = type stat=freq groupdisplay=stack;
xaxis label = "Year" values=(1960 to 2020 by 5);
run;
This is what I want the x axis and plot layout to look like (image from R, but I cannot do it in SAS to show is the issue):
Please try to use the option type=linear in xaxis statement as below
proc sgplot data=nominees;
where year > 1000;
vbar year / group = type stat=freq groupdisplay=stack grouporder=descending;
xaxis label = "Year" type=linear values=(1960 to 2020 by 5);
run;
Please try to use the option type=linear in xaxis statement as below
proc sgplot data=nominees;
where year > 1000;
vbar year / group = type stat=freq groupdisplay=stack grouporder=descending;
xaxis label = "Year" type=linear values=(1960 to 2020 by 5);
run;
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.