<?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 Re: Attempting to Develop a Side-By-Side Boxplot for Multiple Conditions and per a Categorical Varia in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/Attempting-to-Develop-a-Side-By-Side-Boxplot-for-Multiple/m-p/816529#M22898</link>
    <description>&lt;P&gt;You haven't described what you want to plot very well. Which "condition" is to be plotted?&lt;/P&gt;
&lt;P&gt;Box plots are designed to show the distribution of values. You have dichotomous values, so a box plot of those isn't going to be very helpful directly.&lt;/P&gt;</description>
    <pubDate>Sun, 05 Jun 2022 09:06:50 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2022-06-05T09:06:50Z</dc:date>
    <item>
      <title>Attempting to Develop a Side-By-Side Boxplot for Multiple Conditions and per a Categorical Variable</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Attempting-to-Develop-a-Side-By-Side-Boxplot-for-Multiple/m-p/816518#M22896</link>
      <description>&lt;P&gt;Hi everyone,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Looking for a bit of assistance with a snag I've hit. I have a dataset that contains a number of medical conditions with each person having 0, 1, or more than one conditions. For my top five conditions, I would like to create a side-by-side boxplot. I would also like to have each condition comparing gender (male or female). (Sorta something like what is below):&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="7eMcC.png" style="width: 442px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/71995i96E85E7EA81CA3AF/image-size/large?v=v2&amp;amp;px=999" role="button" title="7eMcC.png" alt="7eMcC.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Because each person could have 0 to 5 of the conditions, it isn't possible for me to set up a column on its own of the medical condition which I believe would solve this issue.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Just wondering if anyone has any thoughts.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is an example of what my data could look like&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ID&amp;nbsp; C_1&amp;nbsp; C_2&amp;nbsp; C_3&amp;nbsp; C_4&amp;nbsp; C_5 Gender&lt;/P&gt;&lt;P&gt;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1&amp;nbsp; &amp;nbsp; &amp;nbsp; 0&amp;nbsp; &amp;nbsp; &amp;nbsp; 1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0&amp;nbsp; &amp;nbsp; &amp;nbsp;Male&lt;/P&gt;&lt;P&gt;2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0&amp;nbsp; &amp;nbsp; &amp;nbsp; 0&amp;nbsp; &amp;nbsp; &amp;nbsp; 0&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0&amp;nbsp; &amp;nbsp; &amp;nbsp;Female&lt;/P&gt;&lt;P&gt;3&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0&amp;nbsp; &amp;nbsp; &amp;nbsp; 0&amp;nbsp; &amp;nbsp; &amp;nbsp; 1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0&amp;nbsp; &amp;nbsp; &amp;nbsp;Female&lt;/P&gt;&lt;P&gt;4&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1&amp;nbsp; &amp;nbsp; &amp;nbsp; 0&amp;nbsp; &amp;nbsp; &amp;nbsp; 0&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1&amp;nbsp; &amp;nbsp; &amp;nbsp;Male&lt;/P&gt;&lt;P&gt;5&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0&amp;nbsp; &amp;nbsp; &amp;nbsp; 0&amp;nbsp; &amp;nbsp; &amp;nbsp; 0&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0&amp;nbsp; &amp;nbsp; &amp;nbsp;Male&lt;/P&gt;&lt;P&gt;6&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0&amp;nbsp; &amp;nbsp; &amp;nbsp; 1&amp;nbsp; &amp;nbsp; &amp;nbsp; 0&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0&amp;nbsp; &amp;nbsp; &amp;nbsp;Female&lt;/P&gt;&lt;P&gt;7&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0&amp;nbsp; &amp;nbsp; &amp;nbsp; 0&amp;nbsp; &amp;nbsp; &amp;nbsp; 0&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0&amp;nbsp; &amp;nbsp; &amp;nbsp;Male&lt;/P&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Sun, 05 Jun 2022 01:32:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Attempting-to-Develop-a-Side-By-Side-Boxplot-for-Multiple/m-p/816518#M22896</guid>
      <dc:creator>agille05</dc:creator>
      <dc:date>2022-06-05T01:32:14Z</dc:date>
    </item>
    <item>
      <title>Re: Attempting to Develop a Side-By-Side Boxplot for Multiple Conditions and per a Categorical Varia</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Attempting-to-Develop-a-Side-By-Side-Boxplot-for-Multiple/m-p/816525#M22897</link>
      <description>&lt;P&gt;Where is category "A" "B" "C" come from ?&lt;/P&gt;
&lt;P&gt;Calculated these percent value firstly . then using PROC SGPLOT .&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;proc sgplot data=sashelp.heart;
vbox weight/category=bp_status group=sex;
keylegend /location=inside position=topright across=1 title='';
run;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Ksharp_0-1654408248142.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/71996i00AE343934F6BB12/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Ksharp_0-1654408248142.png" alt="Ksharp_0-1654408248142.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 05 Jun 2022 05:51:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Attempting-to-Develop-a-Side-By-Side-Boxplot-for-Multiple/m-p/816525#M22897</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2022-06-05T05:51:02Z</dc:date>
    </item>
    <item>
      <title>Re: Attempting to Develop a Side-By-Side Boxplot for Multiple Conditions and per a Categorical Varia</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Attempting-to-Develop-a-Side-By-Side-Boxplot-for-Multiple/m-p/816529#M22898</link>
      <description>&lt;P&gt;You haven't described what you want to plot very well. Which "condition" is to be plotted?&lt;/P&gt;
&lt;P&gt;Box plots are designed to show the distribution of values. You have dichotomous values, so a box plot of those isn't going to be very helpful directly.&lt;/P&gt;</description>
      <pubDate>Sun, 05 Jun 2022 09:06:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Attempting-to-Develop-a-Side-By-Side-Boxplot-for-Multiple/m-p/816529#M22898</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2022-06-05T09:06:50Z</dc:date>
    </item>
    <item>
      <title>Re: Attempting to Develop a Side-By-Side Boxplot for Multiple Conditions and per a Categorical Varia</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Attempting-to-Develop-a-Side-By-Side-Boxplot-for-Multiple/m-p/816533#M22899</link>
      <description>Yes, my apologies (wrote this after a very long day and right before bed). The variable I will be plotting against is age.&lt;BR /&gt;&lt;BR /&gt;ID C_1 C_2 C_3 C_4 C_5 Age Gender&lt;BR /&gt;1 1 0 1 0 0 18 Male&lt;BR /&gt;2 0 0 0 1 0 9 Female&lt;BR /&gt;3 0 0 1 0 0 12 Female&lt;BR /&gt;4 1 0 0 0 1 8 Male&lt;BR /&gt;5 0 0 0 1 0 7 Male&lt;BR /&gt;6 0 1 0 0 0 10 Female&lt;BR /&gt;7 0 0 0 0 0 18 Male&lt;BR /&gt;&lt;BR /&gt;Thank you!</description>
      <pubDate>Sun, 05 Jun 2022 11:12:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Attempting-to-Develop-a-Side-By-Side-Boxplot-for-Multiple/m-p/816533#M22899</guid>
      <dc:creator>agille05</dc:creator>
      <dc:date>2022-06-05T11:12:10Z</dc:date>
    </item>
    <item>
      <title>Re: Attempting to Develop a Side-By-Side Boxplot for Multiple Conditions and per a Categorical Varia</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Attempting-to-Develop-a-Side-By-Side-Boxplot-for-Multiple/m-p/816534#M22900</link>
      <description>Thank you for your reply. My apologies for leaving this out. I will be plotting against age.&lt;BR /&gt;&lt;BR /&gt;The C1, C2 etc. are the presence or absence of medication conditions.&lt;BR /&gt;&lt;BR /&gt;Thank you!</description>
      <pubDate>Sun, 05 Jun 2022 11:14:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Attempting-to-Develop-a-Side-By-Side-Boxplot-for-Multiple/m-p/816534#M22900</guid>
      <dc:creator>agille05</dc:creator>
      <dc:date>2022-06-05T11:14:03Z</dc:date>
    </item>
    <item>
      <title>Re: Attempting to Develop a Side-By-Side Boxplot for Multiple Conditions and per a Categorical Varia</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Attempting-to-Develop-a-Side-By-Side-Boxplot-for-Multiple/m-p/816539#M22901</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/425008"&gt;@agille05&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Yes, my apologies (wrote this after a very long day and right before bed). The variable I will be plotting against is age.&lt;BR /&gt;&lt;BR /&gt;ID C_1 C_2 C_3 C_4 C_5 Age Gender&lt;BR /&gt;1 1 0 1 0 0 18 Male&lt;BR /&gt;2 0 0 0 1 0 9 Female&lt;BR /&gt;3 0 0 1 0 0 12 Female&lt;BR /&gt;4 1 0 0 0 1 8 Male&lt;BR /&gt;5 0 0 0 1 0 7 Male&lt;BR /&gt;6 0 1 0 0 0 10 Female&lt;BR /&gt;7 0 0 0 0 0 18 Male&lt;BR /&gt;&lt;BR /&gt;Thank you!&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Still, what do you want to plot "against age"?&lt;/P&gt;
&lt;P&gt;In a vertical box plot the box upper and lower values are the 3rd and 1st quartiles. When you have a dichotomous variable with exactly two values 1 and 0, the "3rd quartile" will be "1st quartile" and the first will be 0. So any plot of C_1 or such will be pretty much the same: a box one unit high so that makes no sense.&lt;/P&gt;
&lt;P&gt;If you want to use C_1 as a category and plot age, then you get two boxes showing the distribution of the ages, one for each level of C_1, which could be grouped by Gender.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's how to provided example data in the form of data step code and two possibilities for plotting. If you want ALL of C_1 and C_2 in the same graph then the data may require some reshaping&lt;/P&gt;
&lt;PRE&gt;data have;
  input ID C_1 C_2 C_3 C_4 C_5 Age Gender $;
datalines;
1 1 0 1 0 0 18 Male
2 0 0 0 1 0 9 Female
3 0 0 1 0 0 12 Female
4 1 0 0 0 1 8 Male
5 0 0 0 1 0 7 Male
6 0 1 0 0 0 10 Female
7 0 0 0 0 0 18 Male
;

Proc sgplot data=have;
   title "Plot of C_1 grouped by gender";
   vbox c_1 /group=gender;
run;

Proc sgplot data=have;
   title "Plot of Age grouped by C_1 and gender ";
   vbox age /category=c_1 group=gender;
run;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 05 Jun 2022 12:26:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Attempting-to-Develop-a-Side-By-Side-Boxplot-for-Multiple/m-p/816539#M22901</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2022-06-05T12:26:09Z</dc:date>
    </item>
    <item>
      <title>Re: Attempting to Develop a Side-By-Side Boxplot for Multiple Conditions and per a Categorical Varia</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Attempting-to-Develop-a-Side-By-Side-Boxplot-for-Multiple/m-p/816546#M22902</link>
      <description>Thank you! Yes, that would be helpful to have. I'm plotting the age distribution for the presence of each medical condition (the C1 to C5). What I would like is to have is each of the 5 conditions plotted (group by gender). Here is the code I have for one condition, but can't seem to get multiples side-by-side owing to the possibility that some participants can have more than one medical condition. Have also tried SGPLOT to no avail.&lt;BR /&gt;&lt;BR /&gt;Proc sgpanel Data=Peds;&lt;BR /&gt;Panelby Chronic_Respiratory_Diseases;&lt;BR /&gt;Where Chronic_Respiratory_Diseases=1;&lt;BR /&gt;Vbox Age / Category=Gender Group=Gender;&lt;BR /&gt;Run;&lt;BR /&gt;Thanks again!</description>
      <pubDate>Sun, 05 Jun 2022 16:13:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Attempting-to-Develop-a-Side-By-Side-Boxplot-for-Multiple/m-p/816546#M22902</guid>
      <dc:creator>agille05</dc:creator>
      <dc:date>2022-06-05T16:13:59Z</dc:date>
    </item>
    <item>
      <title>Re: Attempting to Develop a Side-By-Side Boxplot for Multiple Conditions and per a Categorical Varia</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Attempting-to-Develop-a-Side-By-Side-Boxplot-for-Multiple/m-p/816576#M22903</link>
      <description>You need to restructure your data set and then use the new variable as a grouping variable. &lt;BR /&gt;&lt;BR /&gt;You want your data as:&lt;BR /&gt;&lt;BR /&gt;ID Condition# Age Gender&lt;BR /&gt;1 1 18 Male&lt;BR /&gt;1 3 18 Male&lt;BR /&gt;2 4 23 Female&lt;BR /&gt;....&lt;BR /&gt;&lt;BR /&gt;This your starting point.</description>
      <pubDate>Sun, 05 Jun 2022 23:01:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Attempting-to-Develop-a-Side-By-Side-Boxplot-for-Multiple/m-p/816576#M22903</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2022-06-05T23:01:36Z</dc:date>
    </item>
    <item>
      <title>Re: Attempting to Develop a Side-By-Side Boxplot for Multiple Conditions and per a Categorical Varia</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Attempting-to-Develop-a-Side-By-Side-Boxplot-for-Multiple/m-p/816643#M22904</link>
      <description>&lt;P&gt;So you want to to a box plot of AGE for the C variables&lt;STRONG&gt; when they are equal to 1&lt;/STRONG&gt; grouped by age? That bit about how to use the C variables was a major missing part in the first description.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And as &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt; says, reshape the data:&lt;/P&gt;
&lt;PRE&gt;data have;
  input ID C_1 C_2 C_3 C_4 C_5 Age Gender $;
datalines;
1 1 0 1 0 0 18 Male
2 0 0 0 1 0 9 Female
3 0 0 1 0 0 12 Female
4 1 0 0 0 1 8 Male
5 0 0 0 1 0 7 Male
6 0 1 0 0 0 10 Female
7 0 0 0 0 0 18 Male
;

data toplot;
  set have;
  array c(*) c_1 - c_5;
  do i=1 to dim(c);
     if c[i]=1 then do;
        cat=vname(c[i]);
        output;
     end;
  end;
  keep id age gender cat;
run;

Proc sgplot data=toplot;
   vbox age /category=cat group=gender;
run;&lt;/PRE&gt;</description>
      <pubDate>Mon, 06 Jun 2022 14:35:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Attempting-to-Develop-a-Side-By-Side-Boxplot-for-Multiple/m-p/816643#M22904</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2022-06-06T14:35:25Z</dc:date>
    </item>
    <item>
      <title>Re: Attempting to Develop a Side-By-Side Boxplot for Multiple Conditions and per a Categorical Varia</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Attempting-to-Develop-a-Side-By-Side-Boxplot-for-Multiple/m-p/816666#M22905</link>
      <description>&lt;P&gt;Like butter. You are magic.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks so much for your help and apologies again for not being clearer (second career and I imagine this would have been easier for me to grasp with a younger more nimble brain).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Much appreciated!&lt;/P&gt;</description>
      <pubDate>Mon, 06 Jun 2022 16:15:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Attempting-to-Develop-a-Side-By-Side-Boxplot-for-Multiple/m-p/816666#M22905</guid>
      <dc:creator>agille05</dc:creator>
      <dc:date>2022-06-06T16:15:55Z</dc:date>
    </item>
  </channel>
</rss>

