- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Attempting to create a figure using proc sgplot. Using the GROUP option and want the lines of each group to be different. This is why I specify lineattrs=(pattern=). When I do this, all of the lines on the graph have the same pattern. How do I get the lines to be different patterns? I have four different groups.
proc sgplot data=OutStats_sort;
title"Sampling Distribution of Sample Mean";
density SampleMean/type=normal group=N lineattrs=(pattern=3);
xaxis label="X";
label N="Sample Size";
run;
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
You search SAS documentation long enough and try...try...try...and try again, and you can solve your own problems. I got it!
ods graphics on/attrpriority=none;
proc sgplot data=OutStats_sort;
title"Sampling Distribution of Sample Mean";
styleattrs datalinepatterns=(dot dash solid longdash);
density SampleMean/group=N type=normal;
xaxis label="X";
ods graphics off;
label N="Sample Size";
run;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
How "different" do you mean? Your code, as you have discovered sets the pattern to number 3. Period.
Did you run the code without the lineattrs option and didn't like it?
You can use the STYLEATTRS statement with the DATALINEPATTERNS option to provide a list of patterns to override the default such as
proc sgplot data=OutStats_sort; title"Sampling Distribution of Sample Mean"; styleattrs datalinepatterns=(3 dot solid longdash ) ; /* obviously I do not know which patterns you want*/ density SampleMean/type=normal group=N; xaxis label="X"; label N="Sample Size"; run;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
When I exclude LINEATTRS=(PATTERN=), SAS gives me lines with different colors. I need to produce a document in black and white so the different colors don't help that much. Attempting to get the lines to appear different in a black and white document.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I changed my code to:
proc sgplot data=OutStats_sort;
title"Sampling Distribution of Sample Mean";
styleattrs datalinepatterns=(dot dash solid longdash);
density SampleMean/type=normal group=N;
xaxis label="X";
label N="Sample Size";
run;
When I run the code SAS is using the FIRST datalinepatterns for all four groups. I can't get SAS to use different patterns for different GROUPs. Any suggestions?
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
What about using a style to control that instead, Journal is a good one for black and white.
ods html file='path to your html file' style=journal;
proc sgplot data=OutStats_sort;
title"Sampling Distribution of Sample Mean";
density SampleMean/type=normal group=N;
xaxis label="X";
label N="Sample Size";
run;ods html close;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
You search SAS documentation long enough and try...try...try...and try again, and you can solve your own problems. I got it!
ods graphics on/attrpriority=none;
proc sgplot data=OutStats_sort;
title"Sampling Distribution of Sample Mean";
styleattrs datalinepatterns=(dot dash solid longdash);
density SampleMean/group=N type=normal;
xaxis label="X";
ods graphics off;
label N="Sample Size";
run;