- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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.
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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;
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
In your SAS data set, according to PROC CONTENTS, is variable PCT numeric or text?
Paige Miller
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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;
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.