<?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: Creating a vbar comparing variables in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Creating-a-vbar-comparing-variables/m-p/34601#M8475</link>
    <description>This program indicates that the ages are rounded to the midpoint values, as the first two bar charts appear to be the same.  I you want age ranges 20-29, 30-39 etc. you will need to create a format or a new variable as in AGEG2.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
[pre]&lt;BR /&gt;
proc plan  seed=1245760598;&lt;BR /&gt;
   factors subj=10000 ordered age=1 of 65 sys=1 of 91;&lt;BR /&gt;
   output out=survey age nvals=(20 to 84) sys nvals=(50 to 140);&lt;BR /&gt;
   run;&lt;BR /&gt;
   quit;&lt;BR /&gt;
data survey;&lt;BR /&gt;
   set survey;&lt;BR /&gt;
   ageg = round(age,10);&lt;BR /&gt;
   ageg2 = floor(age/10)*10;&lt;BR /&gt;
   run;&lt;BR /&gt;
proc print data=_last_(obs=100);&lt;BR /&gt;
   run;&lt;BR /&gt;
&lt;BR /&gt;
proc gchart data= survey;&lt;BR /&gt;
   Hbar age / midpoints = 20 to 80 by 10 sumvar=sys type=mean;&lt;BR /&gt;
   Hbar ageg / discrete sumvar=sys type=mean;&lt;BR /&gt;
   Hbar ageg2 / discrete sumvar=sys type=mean;&lt;BR /&gt;
   run;&lt;BR /&gt;
   quit;&lt;BR /&gt;
[/pre]</description>
    <pubDate>Wed, 17 Nov 2010 12:38:03 GMT</pubDate>
    <dc:creator>data_null__</dc:creator>
    <dc:date>2010-11-17T12:38:03Z</dc:date>
    <item>
      <title>Creating a vbar comparing variables</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Creating-a-vbar-comparing-variables/m-p/34598#M8472</link>
      <description>I have a list of ages and blood pressures for 10000 people.  How do I create a gchart bar chart to show average blood pressure for people in their 20s, 30s, 40s, 50, 60s, 70s 80s?  I've gotten to:&lt;BR /&gt;
&lt;BR /&gt;
proc gchart data= survey;&lt;BR /&gt;
vbar age / midpoints = 20 to 80 by 10;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
which isn't all that close.  I can't figure out how to include the average blood pressure (variable: sys) as well.  Thanks in advance.

Message was edited by: YaoPau</description>
      <pubDate>Tue, 16 Nov 2010 23:23:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Creating-a-vbar-comparing-variables/m-p/34598#M8472</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2010-11-16T23:23:06Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a vbar comparing variables</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Creating-a-vbar-comparing-variables/m-p/34599#M8473</link>
      <description>Hi.&lt;BR /&gt;
Your vbar variable is numeric , so SAS will automatically compute midpoint of horizontal axis.&lt;BR /&gt;
You need option ' discrete ' to fit the axis or change 'age' into character type.&lt;BR /&gt;
&lt;BR /&gt;
[pre]&lt;BR /&gt;
proc gchart data= sashelp.class;&lt;BR /&gt;
vbar age / midpoints = 11 to 15 sumvar=height type=mean discrete;&lt;BR /&gt;
run;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
P.S. Actually If you post your question to the 'SAS graphic',There is a sas-man named Robort would solve it.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Ksharp&lt;BR /&gt;
&lt;BR /&gt;
Message was edited by: Ksharp</description>
      <pubDate>Wed, 17 Nov 2010 01:17:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Creating-a-vbar-comparing-variables/m-p/34599#M8473</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2010-11-17T01:17:48Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a vbar comparing variables</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Creating-a-vbar-comparing-variables/m-p/34600#M8474</link>
      <description>You are actually quite close, to incorporate KSharps answer (untested):&lt;BR /&gt;
[pre]proc gchart data= survey;&lt;BR /&gt;
vbar age / midpoints = 20 to 80 by 10&lt;BR /&gt;
               sumvar=pressure type=mean;&lt;BR /&gt;
run;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
Groups for your numeric variable can also be formed using a format.  Using the DISCRETE option will give you one level per value for age.</description>
      <pubDate>Wed, 17 Nov 2010 06:56:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Creating-a-vbar-comparing-variables/m-p/34600#M8474</guid>
      <dc:creator>ArtC</dc:creator>
      <dc:date>2010-11-17T06:56:00Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a vbar comparing variables</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Creating-a-vbar-comparing-variables/m-p/34601#M8475</link>
      <description>This program indicates that the ages are rounded to the midpoint values, as the first two bar charts appear to be the same.  I you want age ranges 20-29, 30-39 etc. you will need to create a format or a new variable as in AGEG2.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
[pre]&lt;BR /&gt;
proc plan  seed=1245760598;&lt;BR /&gt;
   factors subj=10000 ordered age=1 of 65 sys=1 of 91;&lt;BR /&gt;
   output out=survey age nvals=(20 to 84) sys nvals=(50 to 140);&lt;BR /&gt;
   run;&lt;BR /&gt;
   quit;&lt;BR /&gt;
data survey;&lt;BR /&gt;
   set survey;&lt;BR /&gt;
   ageg = round(age,10);&lt;BR /&gt;
   ageg2 = floor(age/10)*10;&lt;BR /&gt;
   run;&lt;BR /&gt;
proc print data=_last_(obs=100);&lt;BR /&gt;
   run;&lt;BR /&gt;
&lt;BR /&gt;
proc gchart data= survey;&lt;BR /&gt;
   Hbar age / midpoints = 20 to 80 by 10 sumvar=sys type=mean;&lt;BR /&gt;
   Hbar ageg / discrete sumvar=sys type=mean;&lt;BR /&gt;
   Hbar ageg2 / discrete sumvar=sys type=mean;&lt;BR /&gt;
   run;&lt;BR /&gt;
   quit;&lt;BR /&gt;
[/pre]</description>
      <pubDate>Wed, 17 Nov 2010 12:38:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Creating-a-vbar-comparing-variables/m-p/34601#M8475</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2010-11-17T12:38:03Z</dc:date>
    </item>
  </channel>
</rss>

