<?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 Sgplot hbar statement for various binary variables needed in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Sgplot-hbar-statement-for-various-binary-variables-needed/m-p/515813#M139243</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm looking for a sgplot hbar statement to generate a graph with 7 binary variables. Each variable needs to be shown with both outcomes having each a bar.&lt;/P&gt;&lt;P&gt;A similar graph to the one I have to generate is shown below.&lt;/P&gt;&lt;P&gt;I would appreciate your help&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Untitled.jpg"&gt;&lt;img src="https://communities.sas.com/skins/images/70F8802BAA6255D55FBEC62A8226FB10/responsive_peak/images/image_not_found.png" alt="Untitled.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Sun, 25 Nov 2018 18:59:24 GMT</pubDate>
    <dc:creator>slg16</dc:creator>
    <dc:date>2018-11-25T18:59:24Z</dc:date>
    <item>
      <title>Sgplot hbar statement for various binary variables needed</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sgplot-hbar-statement-for-various-binary-variables-needed/m-p/515813#M139243</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm looking for a sgplot hbar statement to generate a graph with 7 binary variables. Each variable needs to be shown with both outcomes having each a bar.&lt;/P&gt;&lt;P&gt;A similar graph to the one I have to generate is shown below.&lt;/P&gt;&lt;P&gt;I would appreciate your help&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Untitled.jpg"&gt;&lt;img src="https://communities.sas.com/skins/images/70F8802BAA6255D55FBEC62A8226FB10/responsive_peak/images/image_not_found.png" alt="Untitled.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 25 Nov 2018 18:59:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sgplot-hbar-statement-for-various-binary-variables-needed/m-p/515813#M139243</guid>
      <dc:creator>slg16</dc:creator>
      <dc:date>2018-11-25T18:59:24Z</dc:date>
    </item>
    <item>
      <title>Re: Sgplot hbar statement for various binary variables needed</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sgplot-hbar-statement-for-various-binary-variables-needed/m-p/515823#M139244</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;try this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA HBAR;
ARRAY _X (*) X1-X7;
DO J=1 TO 100;
DO I=1 TO DIM(_X);
RANDOM=RAND("UNIFORM");
_X(I)=(RAND("UNIFORM") LT RANDOM);
END;
OBS+1;
OUTPUT;
END;
DROP I J RANDOM;

RUN;

PROC TRANSPOSE DATA=HBAR OUT=HBARL;
BY OBS;
VAR X:;
RUN;

PROC SGPLOT DATA=WORK.HBARL;
HBAR _NAME_ / GROUP=COL1  GROUPDISPLAY=CLUSTER COLORSTAT=SUM;
RUN;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 25 Nov 2018 20:45:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sgplot-hbar-statement-for-various-binary-variables-needed/m-p/515823#M139244</guid>
      <dc:creator>acordes</dc:creator>
      <dc:date>2018-11-25T20:45:39Z</dc:date>
    </item>
    <item>
      <title>Re: Sgplot hbar statement for various binary variables needed</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sgplot-hbar-statement-for-various-binary-variables-needed/m-p/516038#M139338</link>
      <description>&lt;P&gt;Hi acordes,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm getting error messages when using this code.&lt;/P&gt;&lt;P&gt;I changes variables in different places and the most often shown error is the variable doesn't exist. However, in the work viewtable, the variable is in.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could you maybe indicate where each variable goes, maybe there is my mistake.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;my 7 variables on the y-axis are supposed to be IL_6_cat, sHER_2neu_cat, VEGF_A_cat, sVEGFR_1_cat, uPA_cat, PLGF_cat, Angiopoietin_cat.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;on the x-axis I want to have age or gender.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for further clarification&lt;/P&gt;</description>
      <pubDate>Mon, 26 Nov 2018 16:22:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sgplot-hbar-statement-for-various-binary-variables-needed/m-p/516038#M139338</guid>
      <dc:creator>slg16</dc:creator>
      <dc:date>2018-11-26T16:22:45Z</dc:date>
    </item>
    <item>
      <title>Re: Sgplot hbar statement for various binary variables needed</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sgplot-hbar-statement-for-various-binary-variables-needed/m-p/516045#M139343</link>
      <description>&lt;P&gt;Attached is the graph I got.&lt;/P&gt;&lt;P&gt;However, I need 2 bars per variable with the frequency of age on the x-axis, or the frequency of gender.&lt;/P&gt;&lt;P&gt;The 7 y-axis variables are binary with either 0 or 1.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would appreciate your help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Mon, 26 Nov 2018 16:39:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sgplot-hbar-statement-for-various-binary-variables-needed/m-p/516045#M139343</guid>
      <dc:creator>slg16</dc:creator>
      <dc:date>2018-11-26T16:39:08Z</dc:date>
    </item>
    <item>
      <title>Re: Sgplot hbar statement for various binary variables needed</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sgplot-hbar-statement-for-various-binary-variables-needed/m-p/516139#M139376</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/248251"&gt;@slg16&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Attached is the graph I got.&lt;/P&gt;
&lt;P&gt;However, I need 2 bars per variable with the frequency of age on the x-axis, or the frequency of gender.&lt;/P&gt;
&lt;P&gt;The 7 y-axis variables are binary with either 0 or 1.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would appreciate your help.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;And your code looks like?&lt;/P&gt;
&lt;P&gt;Did you use a GROUP= with your gender variable? And the Groupdisplay=cluster option?&lt;/P&gt;</description>
      <pubDate>Mon, 26 Nov 2018 21:18:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sgplot-hbar-statement-for-various-binary-variables-needed/m-p/516139#M139376</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-11-26T21:18:21Z</dc:date>
    </item>
    <item>
      <title>Re: Sgplot hbar statement for various binary variables needed</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Sgplot-hbar-statement-for-various-binary-variables-needed/m-p/516182#M139385</link>
      <description>&lt;P&gt;@ ballardw&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is the code I used as recommended by an earlier comment.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ATA HBAR;&lt;BR /&gt;ARRAY Age (*) IL_6_cat sHER_2neu_cat VEGF_A_cat sVEGFR_1_cat uPA_cat PLGF_cat Angiopoietin_cat;&lt;BR /&gt;DO J=1 TO 27;&lt;BR /&gt;DO I=1 TO 45-75;&lt;BR /&gt;RANDOM=RAND("UNIFORM");&lt;BR /&gt;Age (I)=(RAND("UNIFORM") LT RANDOM);&lt;BR /&gt;END;&lt;BR /&gt;OBS+1;&lt;BR /&gt;OUTPUT;&lt;BR /&gt;END;&lt;BR /&gt;DROP I J RANDOM;&lt;BR /&gt;RUN;&lt;BR /&gt;&lt;BR /&gt;PROC TRANSPOSE DATA=HBAR OUT=HBARL;&lt;BR /&gt;BY Obs;&lt;BR /&gt;VAR IL_6_cat sHER_2neu_cat VEGF_A_cat sVEGFR_1_cat uPA_cat PLGF_cat Angiopoietin_cat;&lt;BR /&gt;RUN;&lt;BR /&gt;&lt;BR /&gt;PROC SGPLOT DATA=WORK.HBARL;&lt;BR /&gt;HBAR _NAME_ / Group=COL1 GROUPDISPLAY=CLUSTER COLORSTAT=SUM;&lt;BR /&gt;RUN;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However in the column COL1 I only receive . instead of a 1 or 0.&lt;/P&gt;&lt;P&gt;Where is my mistake?&lt;/P&gt;&lt;P&gt;I started of with the age variable instead of gender&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Mon, 26 Nov 2018 23:36:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Sgplot-hbar-statement-for-various-binary-variables-needed/m-p/516182#M139385</guid>
      <dc:creator>slg16</dc:creator>
      <dc:date>2018-11-26T23:36:40Z</dc:date>
    </item>
  </channel>
</rss>

