<?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: Efficiently graph multiple variables (columns) stratified by  dichotomous variable in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/Efficiently-graph-multiple-variables-columns-stratified-by/m-p/719997#M21059</link>
    <description>&lt;P&gt;Reconfigure your data so you can use a BY statement instead to get individual plots?&lt;BR /&gt;&lt;BR /&gt;Flip it using PROC TRANSPOSE so you have the variable names in one column and the values in a second. Then use a single SGPLOT. You can then create some custom versions using a WHERE statement.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sgplot data=....;
*optional where;
where variableName like 'ADOS2_3_%';
by variableName;
vbox variableValue / category = ateam_autistm_yes_no;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/352503"&gt;@amarikow57&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Is there an efficient way to create either boxplots or histograms for multiple continuous variables at once? Such as a do loop or actual function? I tried to look up a loop for graphing online, but didn't find anything that translated for me.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I do not want the graphs to overlap as is happening with this code:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC SGPLOT data = CLEANED.Analytic_Data;
 vbox ADOS2_3_CODINGE_ANXTY_C / category = ATEAM_AUTISM_YES_NO;
 vbox ADOS2_3_SCORESUMM_COMPSCORE / category = ATEAM_AUTISM_YES_NO;
 vbox ADOS2_3_SCORESUMM_RRBTOTAL / category = ATEAM_AUTISM_YES_NO;
 vbox ADOS2_3_SCORESUMM_SATOTAL / category = ATEAM_AUTISM_YES_NO;
 vbox ADOS2_3_SCORESUMM_OVERALL / category = ATEAM_AUTISM_YES_NO;
RUN;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I have about 30 more variables to graph on top of this. I'd rather not have to type out PROC SGPLOT repeatedly if possible. Furthermore, is there a way to get a select group of variables to be side-by-side in a plot (as aforementioned, the above code just overlaps the plots). That is, all variables that start with ADOS2_3 share the same axis in one plot while stratifying the ATEAM_AUTISM_YES_NO, etc.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you in advance.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 17 Feb 2021 18:32:42 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2021-02-17T18:32:42Z</dc:date>
    <item>
      <title>Efficiently graph multiple variables (columns) stratified by  dichotomous variable</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Efficiently-graph-multiple-variables-columns-stratified-by/m-p/719994#M21058</link>
      <description>&lt;P&gt;Is there an efficient way to create either boxplots or histograms for multiple continuous variables at once? Such as a do loop or actual function? I tried to look up a loop for graphing online, but didn't find anything that translated for me.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I do not want the graphs to overlap as is happening with this code:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC SGPLOT data = CLEANED.Analytic_Data;
 vbox ADOS2_3_CODINGE_ANXTY_C / category = ATEAM_AUTISM_YES_NO;
 vbox ADOS2_3_SCORESUMM_COMPSCORE / category = ATEAM_AUTISM_YES_NO;
 vbox ADOS2_3_SCORESUMM_RRBTOTAL / category = ATEAM_AUTISM_YES_NO;
 vbox ADOS2_3_SCORESUMM_SATOTAL / category = ATEAM_AUTISM_YES_NO;
 vbox ADOS2_3_SCORESUMM_OVERALL / category = ATEAM_AUTISM_YES_NO;
RUN;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I have about 30 more variables to graph on top of this. I'd rather not have to type out PROC SGPLOT repeatedly if possible. Furthermore, is there a way to get a select group of variables to be side-by-side in a plot (as aforementioned, the above code just overlaps the plots). That is, all variables that start with ADOS2_3 share the same axis in one plot while stratifying the ATEAM_AUTISM_YES_NO, etc.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you in advance.&lt;/P&gt;</description>
      <pubDate>Wed, 17 Feb 2021 18:24:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Efficiently-graph-multiple-variables-columns-stratified-by/m-p/719994#M21058</guid>
      <dc:creator>amarikow57</dc:creator>
      <dc:date>2021-02-17T18:24:16Z</dc:date>
    </item>
    <item>
      <title>Re: Efficiently graph multiple variables (columns) stratified by  dichotomous variable</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Efficiently-graph-multiple-variables-columns-stratified-by/m-p/719997#M21059</link>
      <description>&lt;P&gt;Reconfigure your data so you can use a BY statement instead to get individual plots?&lt;BR /&gt;&lt;BR /&gt;Flip it using PROC TRANSPOSE so you have the variable names in one column and the values in a second. Then use a single SGPLOT. You can then create some custom versions using a WHERE statement.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sgplot data=....;
*optional where;
where variableName like 'ADOS2_3_%';
by variableName;
vbox variableValue / category = ateam_autistm_yes_no;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/352503"&gt;@amarikow57&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Is there an efficient way to create either boxplots or histograms for multiple continuous variables at once? Such as a do loop or actual function? I tried to look up a loop for graphing online, but didn't find anything that translated for me.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I do not want the graphs to overlap as is happening with this code:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC SGPLOT data = CLEANED.Analytic_Data;
 vbox ADOS2_3_CODINGE_ANXTY_C / category = ATEAM_AUTISM_YES_NO;
 vbox ADOS2_3_SCORESUMM_COMPSCORE / category = ATEAM_AUTISM_YES_NO;
 vbox ADOS2_3_SCORESUMM_RRBTOTAL / category = ATEAM_AUTISM_YES_NO;
 vbox ADOS2_3_SCORESUMM_SATOTAL / category = ATEAM_AUTISM_YES_NO;
 vbox ADOS2_3_SCORESUMM_OVERALL / category = ATEAM_AUTISM_YES_NO;
RUN;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I have about 30 more variables to graph on top of this. I'd rather not have to type out PROC SGPLOT repeatedly if possible. Furthermore, is there a way to get a select group of variables to be side-by-side in a plot (as aforementioned, the above code just overlaps the plots). That is, all variables that start with ADOS2_3 share the same axis in one plot while stratifying the ATEAM_AUTISM_YES_NO, etc.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you in advance.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 17 Feb 2021 18:32:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Efficiently-graph-multiple-variables-columns-stratified-by/m-p/719997#M21059</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-02-17T18:32:42Z</dc:date>
    </item>
    <item>
      <title>Re: Efficiently graph multiple variables (columns) stratified by  dichotomous variable</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Efficiently-graph-multiple-variables-columns-stratified-by/m-p/720000#M21060</link>
      <description>&lt;P&gt;The macro language and a macro %DO loop will do what you want.&amp;nbsp;&lt;A href="https://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.5&amp;amp;docsetId=mcrolref&amp;amp;docsetTarget=p0ri72c3ud2fdtn1qzs2q9vvdiwk.htm&amp;amp;locale=en" target="_blank"&gt;https://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.5&amp;amp;docsetId=mcrolref&amp;amp;docsetTarget=p0ri72c3ud2fdtn1qzs2q9vvdiwk.htm&amp;amp;locale=en&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 17 Feb 2021 18:30:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Efficiently-graph-multiple-variables-columns-stratified-by/m-p/720000#M21060</guid>
      <dc:creator>WarrenKuhfeld</dc:creator>
      <dc:date>2021-02-17T18:30:34Z</dc:date>
    </item>
    <item>
      <title>Re: Efficiently graph multiple variables (columns) stratified by  dichotomous variable</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Efficiently-graph-multiple-variables-columns-stratified-by/m-p/720003#M21061</link>
      <description>&lt;P&gt;As Reeza said, you should reconfigure your data, so that you can use the BY Statement. That would stop you have to write so many VBOX statements.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want the graphs side by side (in different cells), then you should use SGPANEL, instead of SGPLOT, after you have reconfigured your data.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want to also express groups differently on the same cell, then you could look into GROUPDISPLAY = CLUSTER option.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Many thanks,&lt;BR /&gt;&lt;BR /&gt;Kriss&lt;/P&gt;</description>
      <pubDate>Wed, 17 Feb 2021 18:36:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Efficiently-graph-multiple-variables-columns-stratified-by/m-p/720003#M21061</guid>
      <dc:creator>djrisks</dc:creator>
      <dc:date>2021-02-17T18:36:32Z</dc:date>
    </item>
    <item>
      <title>Re: Efficiently graph multiple variables (columns) stratified by  dichotomous variable</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Efficiently-graph-multiple-variables-columns-stratified-by/m-p/720691#M21081</link>
      <description>&lt;P&gt;Hard to give an answer without any sample data.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would transpose the data into three columns (eg.&amp;nbsp;&lt;CODE class=" language-sas"&gt;ADOS2_3_type, ADOS2_3_val ATEAM_AUTISM_YES_NO)&amp;nbsp;&lt;/CODE&gt; and use sgpanel to display them side by side:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sgpanel data=mydat;
panelby ADOS2_3_type / rows=6 columns=5 ;
vbox ADOS2_3_val / category=ATEAM_AUTISM_YES_NO;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 20 Feb 2021 23:06:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Efficiently-graph-multiple-variables-columns-stratified-by/m-p/720691#M21081</guid>
      <dc:creator>ghosh</dc:creator>
      <dc:date>2021-02-20T23:06:46Z</dc:date>
    </item>
  </channel>
</rss>

