<?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: What am I doing Wrong in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/What-am-I-doing-Wrong/m-p/456735#M284374</link>
    <description>&lt;P&gt;First, let's clean up the DATA step in a few ways.&amp;nbsp; Abbreviating the data lines for readability (you wouldn't actually do that), here is an improved version:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;DATA ONE;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;informat FREQ dollar8.;&lt;BR /&gt;INPUT FREQ LOC;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;IF LOC=1 THEN REGION='Southeast';&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;else IF LOC=2 THEN REGION='Northeast';&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;else IF LOC=3 THEN REGION='Midwest';&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;else IF LOC=4 THEN REGION='WEST';&lt;/SPAN&gt;&lt;BR /&gt;Cards;&lt;BR /&gt;$38,655 1&lt;BR /&gt;$31,835 2&lt;BR /&gt;$43,235 2&lt;BR /&gt;$40,600 2&lt;BR /&gt;$35,901 3&lt;BR /&gt;$34,505 3&lt;/P&gt;
&lt;P&gt;;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This version makes FREQ a numeric variable instead of character.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In the ANOVA, one thing stands out as possibly being a problem.&amp;nbsp; In a MEANS statement, are you permitted to use a character variable?&amp;nbsp; (I actually don't know the answer to that.)&amp;nbsp; Instead of using REGION, you could certainly use LOC (in all three places).&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;&lt;SPAN&gt;PROC ANOVA;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;CLASS REGION;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;MODEL MEDINC=REGION;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;MEANS REGION/SCHEFFE TUKEY LSD SNK ALPHA=0.05;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;RUN;&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 24 Apr 2018 00:40:03 GMT</pubDate>
    <dc:creator>Astounding</dc:creator>
    <dc:date>2018-04-24T00:40:03Z</dc:date>
    <item>
      <title>What am I doing Wrong</title>
      <link>https://communities.sas.com/t5/SAS-Programming/What-am-I-doing-Wrong/m-p/456722#M284373</link>
      <description>&lt;P&gt;I am trying to run a simple Anova procedure. Could anyone tell me by looking at the below code what am I doing wrong?&amp;nbsp;I need to get some type of output data beside just listing the dollar amount to the number next to it.&lt;BR /&gt;&lt;BR /&gt;DATA ONE; FIRSTOBS=2 DLM='09'X&lt;BR /&gt;INPUT FREQ $ LOC;&lt;BR /&gt;Cards;&lt;BR /&gt;$36,198 1&lt;BR /&gt;$44,166 4&lt;BR /&gt;$31,874 4&lt;BR /&gt;$32,691 1&lt;BR /&gt;$41,259 4&lt;BR /&gt;$32,126 4&lt;BR /&gt;$42,924 2&lt;BR /&gt;$39,338 2&lt;BR /&gt;$35,166 1&lt;BR /&gt;$33,664 1&lt;BR /&gt;$41,027 4&lt;BR /&gt;$31,159 4&lt;BR /&gt;$37,166 3&lt;BR /&gt;$34,696 3&lt;BR /&gt;$33,226 3&lt;BR /&gt;$33,386 3&lt;BR /&gt;$35,166 1&lt;BR /&gt;$38,655 1&lt;BR /&gt;$31,835 2&lt;BR /&gt;$43,235 2&lt;BR /&gt;$40,600 2&lt;BR /&gt;$35,901 3&lt;BR /&gt;$34,505 3&lt;BR /&gt;$31,184 1&lt;BR /&gt;$30,064 3&lt;BR /&gt;$27,274 4&lt;BR /&gt;$30,844 3&lt;BR /&gt;$35,358 4&lt;BR /&gt;$34,280 2&lt;BR /&gt;$48,631 2&lt;BR /&gt;$31,960 4&lt;BR /&gt;$43,839 2&lt;BR /&gt;$30,778 1&lt;BR /&gt;$32,019 3&lt;BR /&gt;$33,096 3&lt;BR /&gt;$31,606 3&lt;BR /&gt;$33,549 4&lt;BR /&gt;$41,901 2&lt;BR /&gt;$39,196 2&lt;BR /&gt;$32,306 1&lt;BR /&gt;$29,851 3&lt;BR /&gt;$34,098 1&lt;BR /&gt;$38,091 3&lt;BR /&gt;$33,081 4&lt;BR /&gt;$35,541 2&lt;BR /&gt;$37,848 1&lt;BR /&gt;$36,335 4&lt;BR /&gt;$32,533 1&lt;BR /&gt;$33,546 3&lt;BR /&gt;$43,269 4&lt;/P&gt;&lt;P&gt;INPUT FREQ LOC;&lt;BR /&gt;IF LOC=1 THEN REGION='Southeast';&lt;BR /&gt;IF LOC=2 THEN REGION='Northeast';&lt;BR /&gt;IF LOC=3 THEN REGION='Midwest';&lt;BR /&gt;IF LOC=4 THEN REGION='WEST';&lt;BR /&gt;RUN;&lt;BR /&gt;PROC PRINT;&lt;BR /&gt;RUN;&lt;BR /&gt;PROC ANOVA;&lt;BR /&gt;CLASS REGION;&lt;BR /&gt;MODEL MEDINC=REGION;&lt;BR /&gt;MEANS REGION/SCHEFFE TUKEY LSD SNK ALPHA=0.05;&lt;BR /&gt;RUN;&lt;BR /&gt;*/PROC GLM;&lt;BR /&gt;*CLASS REGION;&lt;BR /&gt;*MODEL FREQ=REGION;&lt;BR /&gt;*CONTRAST 'CENTRAL CITY VS. SUBURBS AND RURAL' REGION -1 0.5 0.5;&lt;BR /&gt;*MEANS REGION/SCHEFFE TUKEY LSD SNK ALPHA=0.1;&lt;BR /&gt;*RUN;&lt;BR /&gt;/*PROC NPAR1WAY ANOVA WILCOXON;&lt;BR /&gt;CLASS REGION;&lt;BR /&gt;VAR FREQ;&lt;BR /&gt;RUN;*/&lt;/P&gt;</description>
      <pubDate>Mon, 23 Apr 2018 23:30:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/What-am-I-doing-Wrong/m-p/456722#M284373</guid>
      <dc:creator>timmelvin981</dc:creator>
      <dc:date>2018-04-23T23:30:49Z</dc:date>
    </item>
    <item>
      <title>Re: What am I doing Wrong</title>
      <link>https://communities.sas.com/t5/SAS-Programming/What-am-I-doing-Wrong/m-p/456735#M284374</link>
      <description>&lt;P&gt;First, let's clean up the DATA step in a few ways.&amp;nbsp; Abbreviating the data lines for readability (you wouldn't actually do that), here is an improved version:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;DATA ONE;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;informat FREQ dollar8.;&lt;BR /&gt;INPUT FREQ LOC;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;IF LOC=1 THEN REGION='Southeast';&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;else IF LOC=2 THEN REGION='Northeast';&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;else IF LOC=3 THEN REGION='Midwest';&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;else IF LOC=4 THEN REGION='WEST';&lt;/SPAN&gt;&lt;BR /&gt;Cards;&lt;BR /&gt;$38,655 1&lt;BR /&gt;$31,835 2&lt;BR /&gt;$43,235 2&lt;BR /&gt;$40,600 2&lt;BR /&gt;$35,901 3&lt;BR /&gt;$34,505 3&lt;/P&gt;
&lt;P&gt;;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This version makes FREQ a numeric variable instead of character.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In the ANOVA, one thing stands out as possibly being a problem.&amp;nbsp; In a MEANS statement, are you permitted to use a character variable?&amp;nbsp; (I actually don't know the answer to that.)&amp;nbsp; Instead of using REGION, you could certainly use LOC (in all three places).&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;&lt;SPAN&gt;PROC ANOVA;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;CLASS REGION;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;MODEL MEDINC=REGION;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;MEANS REGION/SCHEFFE TUKEY LSD SNK ALPHA=0.05;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;RUN;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 24 Apr 2018 00:40:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/What-am-I-doing-Wrong/m-p/456735#M284374</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-04-24T00:40:03Z</dc:date>
    </item>
    <item>
      <title>Re: What am I doing Wrong</title>
      <link>https://communities.sas.com/t5/SAS-Programming/What-am-I-doing-Wrong/m-p/456743#M284375</link>
      <description>&lt;P&gt;Thanks for the help but it is still not wanting to run the ANOVA&lt;/P&gt;</description>
      <pubDate>Tue, 24 Apr 2018 01:48:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/What-am-I-doing-Wrong/m-p/456743#M284375</guid>
      <dc:creator>timmelvin981</dc:creator>
      <dc:date>2018-04-24T01:48:10Z</dc:date>
    </item>
    <item>
      <title>Re: What am I doing Wrong</title>
      <link>https://communities.sas.com/t5/SAS-Programming/What-am-I-doing-Wrong/m-p/456745#M284376</link>
      <description>&lt;P&gt;You'll have to help out here.&amp;nbsp; Post the log, so we can see what is not working.&lt;/P&gt;</description>
      <pubDate>Tue, 24 Apr 2018 02:07:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/What-am-I-doing-Wrong/m-p/456745#M284376</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-04-24T02:07:11Z</dc:date>
    </item>
    <item>
      <title>Re: What am I doing Wrong</title>
      <link>https://communities.sas.com/t5/SAS-Programming/What-am-I-doing-Wrong/m-p/456746#M284377</link>
      <description>&lt;P&gt;The following works for me:&lt;/P&gt;
&lt;PRE&gt;DATA ONE; 
  infile cards DLM='09'X;
  INPUT medinc comma7. LOC;
  IF LOC=1 THEN REGION='Southeast';
  else IF LOC=2 THEN REGION='Northeast';
  else IF LOC=3 THEN REGION='Midwest';
  else IF LOC=4 THEN REGION='WEST';
  Cards;
$36,198 1
$44,166 4
$31,874 4
$32,691 1
$41,259 4
$32,126 4
$42,924 2
$39,338 2
$35,166 1
$33,664 1
$41,027 4
$31,159 4
$37,166 3
$34,696 3
$33,226 3
$33,386 3
$35,166 1
$38,655 1
$31,835 2
$43,235 2
$40,600 2
$35,901 3
$34,505 3
$31,184 1
$30,064 3
$27,274 4
$30,844 3
$35,358 4
$34,280 2
$48,631 2
$31,960 4
$43,839 2
$30,778 1
$32,019 3
$33,096 3
$31,606 3
$33,549 4
$41,901 2
$39,196 2
$32,306 1
$29,851 3
$34,098 1
$38,091 3
$33,081 4
$35,541 2
$37,848 1
$36,335 4
$32,533 1
$33,546 3
$43,269 4
;

PROC ANOVA;
CLASS REGION;
MODEL MEDINC=REGION;
MEANS REGION/SCHEFFE TUKEY LSD SNK ALPHA=0.05;
RUN;
&lt;/PRE&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 24 Apr 2018 02:08:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/What-am-I-doing-Wrong/m-p/456746#M284377</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2018-04-24T02:08:17Z</dc:date>
    </item>
    <item>
      <title>Re: What am I doing Wrong</title>
      <link>https://communities.sas.com/t5/SAS-Programming/What-am-I-doing-Wrong/m-p/456751#M284378</link>
      <description>&lt;P&gt;Thank you! The one that you did worked for me also. I am also attempting to do this code with the same one.&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;/PROC GLM;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;CLASS REGION;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;MODEL FREQ=REGION;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;CONTRAST 'CENTRAL CITY VS. SUBURBS AND RURAL' REGION -1 0.5 0.5;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;MEANS REGION/SCHEFFE TUKEY LSD SNK ALPHA=0.1;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;RUN;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;PROC NPAR1WAY ANOVA WILCOXON;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;CLASS REGION;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;VAR FREQ;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;RUN;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;It is also not working. I really appreciate your help as I am beyond a SAS novice!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 24 Apr 2018 02:36:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/What-am-I-doing-Wrong/m-p/456751#M284378</guid>
      <dc:creator>timmelvin981</dc:creator>
      <dc:date>2018-04-24T02:36:52Z</dc:date>
    </item>
    <item>
      <title>Re: What am I doing Wrong</title>
      <link>https://communities.sas.com/t5/SAS-Programming/What-am-I-doing-Wrong/m-p/456760#M284379</link>
      <description>&lt;P&gt;Like with your original code, you refer to a variable called FREQ, but don't have any such variable in your dataset. I presume that you were trying to run:&lt;/P&gt;
&lt;PRE&gt;PROC GLM data=one;;
CLASS REGION;
MODEL MEDINC=REGION;
CONTRAST 'CENTRAL CITY VS. SUBURBS AND RURAL' REGION -1 0.5 0.5;
MEANS REGION/SCHEFFE TUKEY LSD SNK ALPHA=0.1;
RUN;

PROC NPAR1WAY data=one ANOVA WILCOXON;
CLASS REGION;
VAR MEDINC;
RUN;
&lt;/PRE&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 24 Apr 2018 04:00:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/What-am-I-doing-Wrong/m-p/456760#M284379</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2018-04-24T04:00:59Z</dc:date>
    </item>
    <item>
      <title>Re: What am I doing Wrong</title>
      <link>https://communities.sas.com/t5/SAS-Programming/What-am-I-doing-Wrong/m-p/456854#M284380</link>
      <description>&lt;P&gt;Art,&lt;BR /&gt;&lt;BR /&gt;Just wanted to say thank you for your help. It was very much appreciated.&lt;/P&gt;</description>
      <pubDate>Tue, 24 Apr 2018 13:19:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/What-am-I-doing-Wrong/m-p/456854#M284380</guid>
      <dc:creator>timmelvin981</dc:creator>
      <dc:date>2018-04-24T13:19:36Z</dc:date>
    </item>
  </channel>
</rss>

