- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
*specify the path to where the files should be saved;
ods listing gpath='/folders/myfolders/edgeci_plots/ritalinla/';
*specify the output type;
ods graphics / imagename='mygraph' imagefmt=png;
title 'Confidence Interval Range Kslow';
proc sgplot data=boot3 ;
/*highlow x=ratio low=low high=high / type=line;*/
highlow x=ratio low=lower_ci high=upper_ci / type=bar group=block
lineattrs=(color=black) name='a' attrid=Mono;
yaxis label='CI range' grid;
xaxis label='Ratio KaT/KaR' grid values =(0.5 to 2.1 by 0.1);
/*keylegend 'a' / location=outside position=bottom /LEGENDLABEL="PAUC03L";*/
KEYLEGEND/noborder title='PAUCS:';
run;
quit;
The attached code works, however the legend fails to contain all of my blocks, specifically PAUC712L and PAUC71U.
The data is below. All of the data appear in the graph. Can someone tell me either why all of the data do not appear in the legend
or some way to control what appears in the legend? I have tried several methods without success.
Group | Block | Upper_CI | Lower_CI | Ratio |
1 | PAUC03L | 85 | 80 | 0.5 |
1 | PAUC03L | 94 | 88 | 0.55 |
1 | PAUC03L | 95 | 91 | 0.65 |
1 | PAUC03L | 96 | 92 | 0.7 |
1 | PAUC03L | 97 | 94 | 0.8 |
1 | PAUC03U | 103 | 101 | 1.25 |
1 | PAUC03U | 101 | 100 | 1.3 |
1 | PAUC03U | 101 | 100 | 1.4 |
1 | PAUC03U | 109 | 105 | 1.7 |
1 | PAUC03U | 104 | 100 | 2 |
1 | PAUC37L | 106 | 103 | 0.5 |
1 | PAUC37L | 98 | 93 | 0.55 |
1 | PAUC37L | 102 | 101 | 0.65 |
1 | PAUC37L | 102 | 101 | 0.7 |
1 | PAUC37L | 101 | 100 | 0.8 |
1 | PAUC37U | 99 | 98 | 1.25 |
1 | PAUC37U | 99 | 98 | 1.3 |
1 | PAUC37U | 99 | 98 | 1.4 |
1 | PAUC37U | 97 | 96 | 1.7 |
1 | PAUC37U | 98 | 97 | 2 |
1 | PAUC712L | 106 | 104 | 0.5 |
1 | PAUC712L | 106 | 105 | 0.55 |
1 | PAUC712L | 103 | 101 | 0.65 |
1 | PAUC712L | 102 | 101 | 0.7 |
1 | PAUC712L | 101 | 100 | 0.8 |
1 | PAUC712U | 99 | 98 | 1.25 |
1 | PAUC712U | 100 | 99 | 1.3 |
1 | PAUC712U | 100 | 99 | 1.4 |
1 | PAUC712U | 98 | 95 | 1.7 |
1 | PAUC712U | 100 | 98 | 2 |
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
When you comment out the LINEATTRS from the SGPANEL, the fill colors return and also the legend contains all of the line types. The line size was too large and was blocking the graphs underneath.
This solves the issue.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Please provide the data following these instructions, so that we can make use of your exact data and see if we can provide advice.
Paige Miller
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
here it is again.
Group
Block
Upper_CI
Lower_CI
Ratio
Parameter
nGroup
1
PAUC03L
85
80
0.5
Kafast
Kafast
1
PAUC03L
94
88
0.55
Kafast
Kafast
1
PAUC03L
95
91
0.65
Kafast
Kafast
1
PAUC03L
96
92
0.7
Kafast
Kafast
1
PAUC03L
97
94
0.8
Kafast
Kafast
1
PAUC03U
103
101
1.25
Kafast
Kafast
1
PAUC03U
101
100
1.3
Kafast
Kafast
1
PAUC03U
101
100
1.4
Kafast
Kafast
1
PAUC03U
109
105
1.7
Kafast
Kafast
1
PAUC03U
104
100
2
Kafast
Kafast
1
PAUC37L
106
103
0.5
Kafast
Kafast
1
PAUC37L
98
93
0.55
Kafast
Kafast
1
PAUC37L
102
101
0.65
Kafast
Kafast
1
PAUC37L
102
101
0.7
Kafast
Kafast
1
PAUC37L
101
100
0.8
Kafast
Kafast
1
PAUC37U
99
98
1.25
Kafast
Kafast
1
PAUC37U
99
98
1.3
Kafast
Kafast
1
PAUC37U
99
98
1.4
Kafast
Kafast
1
PAUC37U
97
96
1.7
Kafast
Kafast
1
PAUC37U
98
97
2
kAFAST
kAFAST
1
PAUC712L
106
104
0.5
kAFAST
kAFAST
1
PAUC712L
106
105
0.55
kAFAST
kAFAST
1
PAUC712L
103
101
0.65
kAFAST
kAFAST
1
PAUC712L
102
101
0.7
kAFAST
kAFAST
1
PAUC712L
101
100
0.8
kAFAST
kAFAST
1
PAUC712U
99
98
1.25
kAFAST
kAFAST
1
PAUC712U
100
99
1.3
kAFAST
kAFAST
1
PAUC712U
100
99
1.4
kAFAST
kAFAST
1
PAUC712U
98
95
1.7
kAFAST
kAFAST
1
PAUC712U
100
98
2
kAFAST
kAFAST
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
@jacksonan123 you have some really neat code you are requesting assistance in debugging.
Your data sample you have supplied in the original posting looks like Excel type of a format,
then in your reply you pasted a copy of the original sample data which if you look at that is exactly what we get when we put that sample data into a SAS session. It is really unreadable and messy.
To assist with your request you need to convert your data sample into a simple SAS data step with a dateline statement. I would suggest you edit your reply to @PaigeMiller so that this request is not so messy in reading so others might assist without getting a head-ack scrolling. Thanks
How to create a data-step version of your data
https://communities.sas.com/t5/help/faqpage/faq-category-id/posting#posting
https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-dat...
How to Add attachments
https://communities.sas.com/t5/Community-Memo/Adding-attachments-to-your-communities-posts/ba-p/4647...
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Adding .. we need data as SAS data step code (links have been provided explaining how to do this); we don't want and can't use data in any other format. In other words, if you want help on this, you need to do a little extra work to provide your data in the requested format.
Paige Miller
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Group Block Upper_CI Lower_CI Ratio 1 PAUC03L 85 80 0.5 1 PAUC03L 94 88 0.55 1 PAUC03L 95 91 0.65 1 PAUC03L 96 92 0.7 1 PAUC03L 97 94 0.8 1 PAUC03U 103 101 1.25 1 PAUC03U 101 100 1.3 1 PAUC03U 101 100 1.4 1 PAUC03U 109 105 1.7 1 PAUC03U 104 100 2 1 PAUC37L 106 103 0.5 1 PAUC37L 98 93 0.55 1 PAUC37L 102 101 0.65 1 PAUC37L 102 101 0.7 1 PAUC37L 101 100 0.8 1 PAUC37U 99 98 1.25 1 PAUC37U 99 98 1.3 1 PAUC37U 99 98 1.4 1 PAUC37U 97 96 1.7 1 PAUC37U 98 97 2 1 PAUC712L 106 104 0.5 1 PAUC712L 106 105 0.55 1 PAUC712L 103 101 0.65 1 PAUC712L 102 101 0.7 1 PAUC712L 101 100 0.8 1 PAUC712U 99 98 1.25 1 PAUC712U 100 99 1.3 1 PAUC712U 100 99 1.4 1 PAUC712U 98 95 1.7 1 PAUC712U 100 98 2
I have inserted code based upon the link for data less than 50 lines. Hopefully this will allow the data to be seen although some did shift to the left.
How to Add attachments
https://communities.sas.com/t5/Community-Memo/Adding-attachments-to-your-communities-posts/ba-p/4647...
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
This works for me
data boot3;
input Group :$1 Block :$ Upper_CI :8. Lower_CI :8. Ratio :8.;
datalines;
1 PAUC03L 85 80 0.5
1 PAUC03L 94 88 0.55
1 PAUC03L 95 91 0.65
1 PAUC03L 96 92 0.7
1 PAUC03L 97 94 0.8
1 PAUC03U 103 101 1.25
1 PAUC03U 101 100 1.3
1 PAUC03U 101 100 1.4
1 PAUC03U 109 105 1.7
1 PAUC03U 104 100 2
1 PAUC37L 106 103 0.5
1 PAUC37L 98 93 0.55
1 PAUC37L 102 101 0.65
1 PAUC37L 102 101 0.7
1 PAUC37L 101 100 0.8
1 PAUC37U 99 98 1.25
1 PAUC37U 99 98 1.3
1 PAUC37U 99 98 1.4
1 PAUC37U 97 96 1.7
1 PAUC37U 98 97 2
1 PAUC712L 106 104 0.5
1 PAUC712L 106 105 0.55
1 PAUC712L 103 101 0.65
1 PAUC712L 102 101 0.7
1 PAUC712L 101 100 0.8
1 PAUC712U 99 98 1.25
1 PAUC712U 100 99 1.3
1 PAUC712U 100 99 1.4
1 PAUC712U 98 95 1.7
1 PAUC712U 100 98 2
;
*ods listing gpath='/folders/myfolders/edgeci_plots/ritalinla/';
*specify the output type;
*ods graphics / imagename='mygraph' imagefmt=png;
title 'Confidence Interval Range Kslow';
proc sgplot data=boot3 ;
/*highlow x=ratio low=low high=high / type=line;*/
highlow x=ratio low=lower_ci high=upper_ci / type=bar group=block
lineattrs=(color=black) name='a' attrid=Mono;
yaxis label='CI range' grid;
xaxis label='Ratio KaT/KaR' grid values =(0.5 to 2.1 by 0.1);
/*keylegend 'a' / location=outside position=bottom /LEGENDLABEL="PAUC03L";*/
KEYLEGEND/noborder title='PAUCS:';
run;
quit;
I also get those blocks you say were not appearing.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
When I input the data as a *.csv file for some reason it does not read
PAUC712U from block, it only reads PAUC712 which is the reason for it not
being in the legend. The value is a character so I tried to increase its
length via a format statement (i.e., format block $char20.).
It still did not read the entire PAUC71U. What type of format change do I
need?
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
format block $char20.
try format block $20.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
provide the code.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Works for me
your block variable might not be large enough and thus truncating the longest block names.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Whenever some people respond "Works for me," I suspect that the OP is running an older version of SAS than the responders. Please provide your version of SAS by pasting the result from the SAS log after you submit the statement
%put &=SYSVLONG4;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
72
73 %put &=SYSVLONG4;
SYSVLONG4=9.04.01M5P09132017
74
75 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
88
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
When you comment out the LINEATTRS from the SGPANEL, the fill colors return and also the legend contains all of the line types. The line size was too large and was blocking the graphs underneath.
This solves the issue.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
so are you saying @jacksonan123 that the sample size provided was to small for us to recreate the issue in order to provide the correct solution?