I'm working on a vline plot of means (with CIs) over time. My time variable is in days which range from 0 to 194 and I don't want a CI for the many days that will squeeze on the x-axis, so I used the xaxis values= statement but it's being ignored. The documentation says it will be ignored if the values statement creates over 1,000 points, but this doesn't so I'm not sure what I'm doing wrong.
ods graphics on;
proc sgplot data=alldat;
vline timedays/response=alkphos
stat=mean
limits=both
limitstat=clm
markers datalabel;
xaxis values=(0 to 250 by 50);
run;
(I have also tried "0 to 200 by 50" and "-50 to 250 by 50" with the same result)
Can you describe how you would like your graph to look? - PG
Ideally the x-axis is time with ticks at 0, 50, 100, 150, and 200 days only; the y-axis is alk phos. It will show the mean and 95% CL for alk phos at each of the 5 time points. I am getting all of that now except that there are something like 30 time points and the graph looks cluttered.
If you only want 5 time points you have a couple options. One is to use a WHERE clause to restrict data to those values of x.
If you are looking to combine things such that time points from say 25 to 75 display and are considered as time value 50 the easiest might be to create a format centered.
Some thing like:
proc format;
value myx
-25 - 25 = ' 0'
25 <- 75 = ' 50'
75 <- 125 = '100'
125 <- 175 = '150'
175 <- 225 = '200'
;
run;
and in your sgplot syntax add
format timedays myx. ;
Another option is to show the line for all points and the error bars only at your desired points as in :
data allDatGraph;
set alldat;
if mod(timedays,50)=0 then alkPhosSpec=alkPhos;
run;
ods graphics on;
proc sgplot data=allDatGraph;
vline timedays/response=alkphos
stat=mean;
vline timedays/response=alkphosSpec
stat=mean
limits=both
limitstat=clm
break markers datalabel;
xaxis fitpolicy=thin;
run;
PG
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.