BookmarkSubscribeRSS Feed
MeredithG
Calcite | Level 5

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)

4 REPLIES 4
PGStats
Opal | Level 21

Can you describe how you would like your graph to look? - PG

PG
MeredithG
Calcite | Level 5

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.

ballardw
Super User

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. ;


PGStats
Opal | Level 21

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

PG

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

What is Bayesian Analysis?

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.

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
  • 2027 views
  • 0 likes
  • 3 in conversation