<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Boxplot with multiple variables in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/Boxplot-with-multiple-variables/m-p/772881#M22113</link>
    <description>&lt;P&gt;I want to make a plot similar to this one, but I really have no idea how. I have four variable I want to include - sex, race, educ, and diet, and I want a variable called homoc on the y axis. Any ideas? Thanks!&amp;nbsp;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screen Shot 2021-10-07 at 4.59.43 PM.png" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/64495i1D899F204AC4E5C2/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screen Shot 2021-10-07 at 4.59.43 PM.png" alt="Screen Shot 2021-10-07 at 4.59.43 PM.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 07 Oct 2021 21:01:15 GMT</pubDate>
    <dc:creator>joachimg</dc:creator>
    <dc:date>2021-10-07T21:01:15Z</dc:date>
    <item>
      <title>Boxplot with multiple variables</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Boxplot-with-multiple-variables/m-p/772881#M22113</link>
      <description>&lt;P&gt;I want to make a plot similar to this one, but I really have no idea how. I have four variable I want to include - sex, race, educ, and diet, and I want a variable called homoc on the y axis. Any ideas? Thanks!&amp;nbsp;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screen Shot 2021-10-07 at 4.59.43 PM.png" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/64495i1D899F204AC4E5C2/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screen Shot 2021-10-07 at 4.59.43 PM.png" alt="Screen Shot 2021-10-07 at 4.59.43 PM.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Oct 2021 21:01:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Boxplot-with-multiple-variables/m-p/772881#M22113</guid>
      <dc:creator>joachimg</dc:creator>
      <dc:date>2021-10-07T21:01:15Z</dc:date>
    </item>
    <item>
      <title>Re: Boxplot with multiple variables</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Boxplot-with-multiple-variables/m-p/772897#M22114</link>
      <description>&lt;P&gt;One way involves reshaping the data bit. Here is an example using a data set you should have that will allow you to run the code.&lt;/P&gt;
&lt;PRE&gt;data toplot;
  set sashelp.class;
  length vn $ 10;
  vn='Sex'; category=put(sex,$5.); output;
  vn='Age'; category=put(age,f5.); output;
run;

proc sgplot data=toplot noautolegend;
   vbox weight /group=vn category=category;
   xaxis label=' ';

run;&lt;/PRE&gt;
&lt;P&gt;The data step makes a duplicate of your analysis variable(s), in this case we could use either or both of the Height and Weight variables. We add a variable for the Group role using the name of the variable. This sets the colors for related values the same. We also add a variable for the Category role, which means each value will get a separate box created. I made sure the text created has the same length to avoid possible problems. The Output statement if you haven't used it, tells the program to write to the data set when encountered. This is where the values for each analysis variable get duplicated.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The Sgplot uses the created data set. Since your example doesn't show a key for the groups (Probably because your text is fairly explanatory) is suppress the automatic legend that would have the values of the Group variable as key to the colors. The Xaxis statement also suppresses any axis label. The vertical axis label will by default be the label associated with your analysis variable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;A REFLINE statement can add a reference line. I'm not sure if you actually wanted one, or where and I don't have your data to make any guess.&amp;nbsp; A simple:&amp;nbsp; REFLINE 50; would place a horizontal line across the graph at the Y axis value of 50. There are options to set line types and labels if desired.&lt;/P&gt;</description>
      <pubDate>Thu, 07 Oct 2021 22:39:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Boxplot-with-multiple-variables/m-p/772897#M22114</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-10-07T22:39:55Z</dc:date>
    </item>
    <item>
      <title>Re: Boxplot with multiple variables</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Boxplot-with-multiple-variables/m-p/773014#M22116</link>
      <description>&lt;PRE&gt;data toplot;
  set sashelp.class;
  length vn $ 10;
  vn='Sex'; category=put(sex,$5.); output;
  vn='Age'; category=put(age,f5.); output;
run;
proc sgpanel data=toplot noautolegend;
panelby vn/layout=columnlattice onepanel uniscale=row noheader;
vbox weight/category=category group=vn;
rowaxis display=(nolabel);
colaxis display=(nolabel);
run;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="x.png" style="width: 640px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/64516i9FC64A44762619C6/image-size/large?v=v2&amp;amp;px=999" role="button" title="x.png" alt="x.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Oct 2021 11:57:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Boxplot-with-multiple-variables/m-p/773014#M22116</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2021-10-08T11:57:22Z</dc:date>
    </item>
    <item>
      <title>Re: Boxplot with multiple variables</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Boxplot-with-multiple-variables/m-p/773153#M22129</link>
      <description>Thank you so much!</description>
      <pubDate>Fri, 08 Oct 2021 21:06:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Boxplot-with-multiple-variables/m-p/773153#M22129</guid>
      <dc:creator>joachimg</dc:creator>
      <dc:date>2021-10-08T21:06:02Z</dc:date>
    </item>
    <item>
      <title>Re: Boxplot with multiple variables</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Boxplot-with-multiple-variables/m-p/773154#M22130</link>
      <description>Thank you so much! This worked as well. Really appreciate the help.</description>
      <pubDate>Fri, 08 Oct 2021 21:06:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Boxplot-with-multiple-variables/m-p/773154#M22130</guid>
      <dc:creator>joachimg</dc:creator>
      <dc:date>2021-10-08T21:06:23Z</dc:date>
    </item>
  </channel>
</rss>

