<?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: GCHART Error when running character variable &amp;quot;Sex&amp;quot; in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/GCHART-Error-when-running-character-variable-quot-Sex-quot/m-p/153669#M5723</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The error message mentions a 'by group', but I don't see a by-statement in your SAS code.&lt;/P&gt;&lt;P&gt;Are you showing us all the code, or does your code perhaps have 'by sex' in it?&lt;/P&gt;&lt;P&gt;Here's some sample code, using sashelp.class, that reproduces a similar error using a 'by' statement...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data foo; set sashelp.class;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;PROC GCHART data=foo;&lt;/P&gt;&lt;P&gt;by sex;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; TITLE "Average Age conditional on Sex";&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; VBAR age / group=sex&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DISCRETE&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; TYPE=MEAN SUMVAR=AGE;&lt;/P&gt;&lt;P&gt;RUN;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And here's one possible work-around:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sort data=sashelp.class out=foo;&lt;/P&gt;&lt;P&gt;by sex;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;PROC GCHART data=foo;&lt;/P&gt;&lt;P&gt;by sex;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; TITLE "Average Age conditional on Sex";&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; VBAR age / group=sex&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DISCRETE&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; TYPE=MEAN SUMVAR=AGE;&lt;/P&gt;&lt;P&gt;RUN;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 03 Nov 2014 13:41:33 GMT</pubDate>
    <dc:creator>GraphGuy</dc:creator>
    <dc:date>2014-11-03T13:41:33Z</dc:date>
    <item>
      <title>GCHART Error when running character variable "Sex"</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/GCHART-Error-when-running-character-variable-quot-Sex-quot/m-p/153667#M5721</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Whenever I run my program for a vertical bar chart using "sex" as the variable i keep getting this error. I tried using a PROC SORT statement before the PROC GCHART statement but keep getting this error message when I run the program. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;PROC GCHART&lt;/STRONG&gt; data=ACS;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; TITLE&lt;/STRONG&gt; "Average Age conditional on Sex";&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 10pt; line-height: 1.5em;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; VBAR&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt; age / group=sex &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DISCRETE&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/STRONG&gt;&lt;STRONG style="font-size: 10pt; line-height: 1.5em;"&gt;TYPE&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;=MEAN &lt;/SPAN&gt;&lt;STRONG style="font-size: 10pt; line-height: 1.5em;"&gt;SUMVAR&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;=AGE;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;RUN&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;QUIT&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 10pt; line-height: 1.5em;"&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt;"&gt;&lt;STRONG style="font-size: 10pt; line-height: 1.5em;"&gt;ERROR: Data set WORK.ACS is not sorted in ascending sequence. The current BY group has SEX = 2 and the next BY group has SEX = 1.&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If anyone can show me where I am messing up it would be greatly appreciated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;--Michael FLetcher&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 02 Nov 2014 21:58:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/GCHART-Error-when-running-character-variable-quot-Sex-quot/m-p/153667#M5721</guid>
      <dc:creator>FLETCHSAS</dc:creator>
      <dc:date>2014-11-02T21:58:35Z</dc:date>
    </item>
    <item>
      <title>Re: GCHART Error when running character variable "Sex"</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/GCHART-Error-when-running-character-variable-quot-Sex-quot/m-p/153668#M5722</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This could be possible if the sex variable is character. Then it may not sort properly. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Jag&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 Nov 2014 01:14:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/GCHART-Error-when-running-character-variable-quot-Sex-quot/m-p/153668#M5722</guid>
      <dc:creator>Jagadishkatam</dc:creator>
      <dc:date>2014-11-03T01:14:13Z</dc:date>
    </item>
    <item>
      <title>Re: GCHART Error when running character variable "Sex"</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/GCHART-Error-when-running-character-variable-quot-Sex-quot/m-p/153669#M5723</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The error message mentions a 'by group', but I don't see a by-statement in your SAS code.&lt;/P&gt;&lt;P&gt;Are you showing us all the code, or does your code perhaps have 'by sex' in it?&lt;/P&gt;&lt;P&gt;Here's some sample code, using sashelp.class, that reproduces a similar error using a 'by' statement...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data foo; set sashelp.class;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;PROC GCHART data=foo;&lt;/P&gt;&lt;P&gt;by sex;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; TITLE "Average Age conditional on Sex";&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; VBAR age / group=sex&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DISCRETE&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; TYPE=MEAN SUMVAR=AGE;&lt;/P&gt;&lt;P&gt;RUN;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And here's one possible work-around:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sort data=sashelp.class out=foo;&lt;/P&gt;&lt;P&gt;by sex;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;PROC GCHART data=foo;&lt;/P&gt;&lt;P&gt;by sex;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; TITLE "Average Age conditional on Sex";&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; VBAR age / group=sex&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DISCRETE&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; TYPE=MEAN SUMVAR=AGE;&lt;/P&gt;&lt;P&gt;RUN;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 Nov 2014 13:41:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/GCHART-Error-when-running-character-variable-quot-Sex-quot/m-p/153669#M5723</guid>
      <dc:creator>GraphGuy</dc:creator>
      <dc:date>2014-11-03T13:41:33Z</dc:date>
    </item>
    <item>
      <title>Re: GCHART Error when running character variable "Sex"</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/GCHART-Error-when-running-character-variable-quot-Sex-quot/m-p/153670#M5724</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I had that same question that Robert stated above. That message is typically a BY-group message. However, I do have a more general question. Is that code going to give you what you want? Here is your code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;STRONG style="font-style: inherit; font-family: inherit;"&gt;PROC GCHART&lt;/STRONG&gt; data=ACS;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;STRONG style="font-style: inherit; font-family: inherit;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; TITLE&lt;/STRONG&gt; "Average Age conditional on Sex";&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;STRONG style="font-style: inherit; font-size: 10pt; font-family: inherit;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; VBAR&lt;/STRONG&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 10pt; font-family: inherit;"&gt; age / group=sex&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;STRONG style="font-style: inherit; font-family: inherit;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DISCRETE&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;STRONG style="font-style: inherit; font-family: inherit;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/STRONG&gt;&lt;STRONG style="font-style: inherit; font-size: 10pt; font-family: inherit;"&gt;TYPE&lt;/STRONG&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 10pt; font-family: inherit;"&gt;=MEAN &lt;/SPAN&gt;&lt;STRONG style="font-style: inherit; font-size: 10pt; font-family: inherit;"&gt;SUMVAR&lt;/STRONG&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 10pt; font-family: inherit;"&gt;=AGE;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;STRONG style="font-style: inherit; font-family: inherit;"&gt;RUN&lt;/STRONG&gt;;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;STRONG style="font-style: inherit; font-family: inherit;"&gt;QUIT&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Based on your title, you are looking for the average age based on sex. However, the average will always be the same as the categorical value in this graph because both the categorical variable and the response variable are "age". The mean is computed for each age in "age", which will always give you the age back. Perhaps your desire was to do something more like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;STRONG style="font-style: inherit; font-family: inherit;"&gt;PROC GCHART&lt;/STRONG&gt; data=ACS;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;STRONG style="font-style: inherit; font-family: inherit;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; TITLE&lt;/STRONG&gt; "Average Age conditional on Sex";&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;STRONG style="font-style: inherit; font-size: 10pt; font-family: inherit;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; VBAR&lt;/STRONG&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 10pt; font-family: inherit;"&gt; sex / &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;STRONG style="font-style: inherit; font-family: inherit;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DISCRETE&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;STRONG style="font-style: inherit; font-family: inherit;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/STRONG&gt;&lt;STRONG style="font-style: inherit; font-size: 10pt; font-family: inherit;"&gt;TYPE&lt;/STRONG&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 10pt; font-family: inherit;"&gt;=MEAN &lt;/SPAN&gt;&lt;STRONG style="font-style: inherit; font-size: 10pt; font-family: inherit;"&gt;SUMVAR&lt;/STRONG&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 10pt; font-family: inherit;"&gt;=AGE;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;STRONG style="font-style: inherit; font-family: inherit;"&gt;RUN&lt;/STRONG&gt;;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;STRONG style="font-style: inherit; font-family: inherit;"&gt;QUIT&lt;/STRONG&gt;;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;I believe this will give you the average age conditional on sex.&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;Hope this helps!&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;Dan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 Nov 2014 15:11:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/GCHART-Error-when-running-character-variable-quot-Sex-quot/m-p/153670#M5724</guid>
      <dc:creator>DanH_sas</dc:creator>
      <dc:date>2014-11-03T15:11:21Z</dc:date>
    </item>
    <item>
      <title>Re: GCHART Error when running character variable "Sex"</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/GCHART-Error-when-running-character-variable-quot-Sex-quot/m-p/153671#M5725</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you Robert. Hit the nail right on the head runs error free now. Hope all is well.&lt;/P&gt;&lt;P&gt;--MFletcher&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Nov 2014 00:09:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/GCHART-Error-when-running-character-variable-quot-Sex-quot/m-p/153671#M5725</guid>
      <dc:creator>FLETCHSAS</dc:creator>
      <dc:date>2014-11-06T00:09:08Z</dc:date>
    </item>
  </channel>
</rss>

