BookmarkSubscribeRSS Feed
Leo9
Quartz | Level 8

Hello,

 

I am trying to display a lab test values for a particular test by visit. There are lot of "unscheduled" visits in the data.

I want to display the values from unscheduled in the graph, but on x-axis I do not want to display "unscheduled"

visits. I only want to display schedule visits like - baseline, week2, week 2, etc.

 

How can this be done ?

 

For ex :

 

Visit                  Values

Baseline              20

Week 1                25

Unschedule 1.1   26

Week 2                27

Unschedule 2.1   28

....

 

I want to display all the above values but in x-axis I want to display only - Baseline, Week 1, Week 2, etc no unschedule visits.

 

 

6 REPLIES 6
Jay54
Meteorite | Level 14

Use the VALUES option on the x-axis to include only the values you want.  Provide a format to display the numeric values as the text description on the axis.

Leo9
Quartz | Level 8

Thanks Sanjay. I want all the values to be displayed - including unscheduled visits but I don't want to show the "Unscheduled" visits labels on the x-axis. Basically, I want to display values from all the visits including unschedule visits on the graph but on the x-axis label, I want to show label for selected visits (only schedule visits not unscheduled). I don't know if it is possible. 

 

For ex - I would like to display data from unschedule visits 1.1 but I do not want this label to appear on x-axis. This value should only be in graph. 

RW9
Diamond | Level 26 RW9
Diamond | Level 26

Try using the example Sanjay has provided and come back with any further questions.  Values option specifies the values which appear on the axis line, it does not restrict any data.

 

Also, have a look at his excellent blog on Graphs - it covers pretty much anything you can think of:

http://blogs.sas.com/content/graphicallyspeaking/

Leo9
Quartz | Level 8

I tried Sanjay's suggestion but it is not working. There are lot of visits in the data. Here is the code I am using.

 

proc sgplot data = lb ;
series x=visitnum y=lbstresn / group = usubjid markers lineattrs = (thickness = 2) ;
xaxis label = "Study Weeks"  type = linear 
values = (1 1.02 2 5.01 6 7 7.01 7.02 8 8.01 8.02 9 9.01 9.02 10 10.01 10.02 10.03 10.04 11 11.01 11.02 11.03 12
12.01 13 13.01 14 14.01 15 16 16.01 17 17.01 18 19 20 21 22 22.01 23 23.01 24 25 25.01 26 27 28 29
30 30.01 30.02 31 31.01 31.02 32 32.01 33 33.01 33.02 33.03 33.04 33.05 33.06 33.07 34 34.01 34.02
34.03 34.04 34.05 34.06 34.07 35 35.01 35.02 35.03 35.04 36 36.01 36.02 36.03 36.05 36.06 36.07 36.08
36.09 36.1 36.11) valuesformat = tick. ;
yaxis label = "ALT (IU/L)" values = (0 to 100 by 10) display = all;
keylegend / location = outside position = bottom valueattrs = (size=7) title = 'Subject ID';

refline 43 / axis = y lineattrs = (pattern = shortdash) label = 'ULN' labelpos = max;
run;

 

The tick format is 

 

Proc format;

value tick
1 = 'Screening'
2 = 'Baseline'
6 = 'Week 1(Day 8)'
7 = 'Week 2'
8 = 'Week 3'
9 = 'Week 4'
10 = 'Week 5'
11 = 'Week 6'
12 = 'Week 7'
15 = 'Week 8'
18 = 'Week 9'
21 = 'Week 10'
24 = 'Week 11'
27 = 'Week 12'
30 = 'Week 13'
31 = 'Week 14'
32 = 'Week 15'
33 = 'Week 16'
34 = 'Week 20'
35 = 'Week 28'
36 = 'Week 36'
other = ' '
;
run;

 

 

DanH_sas
SAS Super FREQ

The VALUES list should contain only the numbers 1 throught 36. The values not directly on 1 - 36 will still plot correctly, since this is a linear axis.

Leo9
Quartz | Level 8

When I change type from "linear" to "discrete" it is plotting all the ticks on x-axis but it is not picking the format.

For example I see ticks - 1, 1.02, 2, etc but these values are not getting displayed as per the format. Basiaclly,

the format tick. is not working when I change type to discrete. What am I missing ? 

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!

How to Concatenate Values

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.

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
  • 6 replies
  • 4430 views
  • 0 likes
  • 4 in conversation