BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
Dregerator
Obsidian | Level 7

Hi, 

 

I'm trying to create a series plot from 1 to 400 dilution with this data, however, any time I try to create a discrete y-axis value from 0-100 data values don't appear on the graph. 

PARAMCD PCT DIL
Test1 25.5 1
Test5 36.4 1
Test6 30.6 1
Test8 41.7 1
Test9 44.0 1
Test100 43.3 1
Test1 40.6 2
Test5 60.3 2
Test6 46.2 2
Test8 49.1 2
Test9 49.8 2
Test100 50.0 2
Test1 48.0 4
Test5 74.1 4
Test6 55.4 4
Test8 54.2 4
Test9 55.6 4
Test100 56.5 4
Test1 54.7 8
Test5 83.0 8
Test6 61.6 8
Test8 61.4 8
Test9 62.1 8
Test100 61.6 8
Test1 60.3 16
Test5 90.6 16
Test6 68.7 16
Test8 66.1 16
Test9 66.3 16
Test100 66.5 16
Test1 74.5 80
Test5 97.6 80
Test6 85.9 80
Test8 83.5 80
Test9 81.2 80
Test100 83.0 80
Test1 91.1 400
Test5 100.0 400
Test6 96.0 400
Test8 95.1 400
Test9 94.6 400
Test100 95.5 400

 

 

this is what I'm trying to do with code 

 

proc sgplot data=graph;
series x=dil y=pct/group=paramcd;
xaxis values=(1 2 4 8 16 80 400 2000) label="Dilution Level" ;
yaxis values=(0 to 100 by 10) label="% Negative";
run;

 

Cosmetic stuff such as tick markers appearing on x-axis is also another issue. Any help is appreciated. 

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

When I create a data step with your text and PCT is a numeric variable:

data have;
   input PARAMCD $ 	PCT 	DIL   ;
datalines;
Test1 	25.5 	1
Test5 	36.4 	1
Test6 	30.6 	1
Test8 	41.7 	1
Test9 	44.0 	1
Test100 	43.3 	1
Test1 	40.6 	2
Test5 	60.3 	2
Test6 	46.2 	2
Test8 	49.1 	2
Test9 	49.8 	2
Test100 	50.0 	2
Test1 	48.0 	4
Test5 	74.1 	4
Test6 	55.4 	4
Test8 	54.2 	4
Test9 	55.6 	4
Test100 	56.5 	4
Test1 	54.7 	8
Test5 	83.0 	8
Test6 	61.6 	8
Test8 	61.4 	8
Test9 	62.1 	8
Test100 	61.6 	8
Test1 	60.3 	16
Test5 	90.6 	16
Test6 	68.7 	16
Test8 	66.1 	16
Test9 	66.3 	16
Test100 	66.5 	16
Test1 	74.5 	80
Test5 	97.6 	80
Test6 	85.9 	80
Test8 	83.5 	80
Test9 	81.2 	80
Test100 	83.0 	80
Test1 	91.1 	400
Test5 	100.0 	400
Test6 	96.0 	400
Test8 	95.1 	400
Test9 	94.6 	400
Test100 	95.5 	400
;

proc sgplot data=have;
   series x=dil y=pct/group=paramcd;
   xaxis values=(1 2 4 8 16 80 400 2000) label="Dilution Level" ;
   yaxis values=(0 to 100 by 10) label="% Negative";
run;

SGPlot.png

 

So one suspects that your PCT variable is character. So the YAXIS values don't work with your data.

 

Because you have such a wide range, 1 to 2000 for the Xaxis there may not be enough space on that axis as linear to show 1, 2, 4 and 8. You can try FITPOLICY=STAGGER on the Xaxis and if your graph width space is large enough you might see them. Or use TYPE=LOG on the Xaxis to create a logarithmic scaled axis.

View solution in original post

5 REPLIES 5
PaigeMiller
Diamond | Level 26

Can you please show us the output that you get, and explain what is wrong with the output? (Use the "Insert photos" icon to include screen captures in your reply)

--
Paige Miller
Dregerator
Obsidian | Level 7

with yaxis condition.PNGwithout yaxis.PNG

 

this first is with the y-axis condition. and the second one is without it. I just want a line graph for each of the parameter at the specific ticks to tell me what the percentage is at that tick. Right now, the percentage is going all over the place and I want it to go from 0-100 so we can interpret if values go up and down over dilutions. 

 

I even proc sort before it 

 

proc sort data=graph;
by dil;
run;

proc sgplot data=graph;
series x=dil y=pct/group=paramcd;
xaxis values=(1 2 4 8 16 80 400 2000) label="Dilution Level" ;
*yaxis values=(0 to 100 by 10) label="% Negative";
run;

PaigeMiller
Diamond | Level 26

In your SAS data set, according to PROC CONTENTS, is variable PCT numeric or text?

--
Paige Miller
Reeza
Super User

What does the log show?

 

Also does PCT have a format attached?

 

If the data fluctuates, there's nothing you can do about that, that's the data. 

But it should show up for the 0 to 100. 

ballardw
Super User

When I create a data step with your text and PCT is a numeric variable:

data have;
   input PARAMCD $ 	PCT 	DIL   ;
datalines;
Test1 	25.5 	1
Test5 	36.4 	1
Test6 	30.6 	1
Test8 	41.7 	1
Test9 	44.0 	1
Test100 	43.3 	1
Test1 	40.6 	2
Test5 	60.3 	2
Test6 	46.2 	2
Test8 	49.1 	2
Test9 	49.8 	2
Test100 	50.0 	2
Test1 	48.0 	4
Test5 	74.1 	4
Test6 	55.4 	4
Test8 	54.2 	4
Test9 	55.6 	4
Test100 	56.5 	4
Test1 	54.7 	8
Test5 	83.0 	8
Test6 	61.6 	8
Test8 	61.4 	8
Test9 	62.1 	8
Test100 	61.6 	8
Test1 	60.3 	16
Test5 	90.6 	16
Test6 	68.7 	16
Test8 	66.1 	16
Test9 	66.3 	16
Test100 	66.5 	16
Test1 	74.5 	80
Test5 	97.6 	80
Test6 	85.9 	80
Test8 	83.5 	80
Test9 	81.2 	80
Test100 	83.0 	80
Test1 	91.1 	400
Test5 	100.0 	400
Test6 	96.0 	400
Test8 	95.1 	400
Test9 	94.6 	400
Test100 	95.5 	400
;

proc sgplot data=have;
   series x=dil y=pct/group=paramcd;
   xaxis values=(1 2 4 8 16 80 400 2000) label="Dilution Level" ;
   yaxis values=(0 to 100 by 10) label="% Negative";
run;

SGPlot.png

 

So one suspects that your PCT variable is character. So the YAXIS values don't work with your data.

 

Because you have such a wide range, 1 to 2000 for the Xaxis there may not be enough space on that axis as linear to show 1, 2, 4 and 8. You can try FITPOLICY=STAGGER on the Xaxis and if your graph width space is large enough you might see them. Or use TYPE=LOG on the Xaxis to create a logarithmic scaled axis.

SAS Innovate 2025: Call for Content

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!

Submit your idea!

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
  • 5 replies
  • 922 views
  • 2 likes
  • 4 in conversation