<?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: Unable to figure error in else if then statement in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Unable-to-figure-error-in-else-if-then-statement/m-p/501734#M133820</link>
    <description>&lt;P&gt;do you have a list of the variables in SAS dataset &lt;SPAN&gt;DAT.finger?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;is control in that list?&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 05 Oct 2018 02:48:51 GMT</pubDate>
    <dc:creator>VDD</dc:creator>
    <dc:date>2018-10-05T02:48:51Z</dc:date>
    <item>
      <title>Unable to figure error in else if then statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Unable-to-figure-error-in-else-if-then-statement/m-p/501719#M133813</link>
      <description>&lt;P&gt;Hello, thank you for any and all help. I am trying to run the below code and keep getting the below errors. Any suggestions on what I am doing wrong?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data temp;&lt;BR /&gt;set dat.finger;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;if missing=1 then do;&lt;BR /&gt;segmentation='mine';&lt;BR /&gt;rNumb2=ranuni(5678);&lt;BR /&gt;if rNumb2&amp;lt; 0.50 then sun=1;&lt;BR /&gt;else sun=2;&lt;/P&gt;&lt;P&gt;If control not in (‘C’,’T’) then rNumb=ranuni(1234);&lt;BR /&gt;If control=’C’ then control2=’C’;&lt;BR /&gt;Else if control=’T’ then control2=’T’;&lt;BR /&gt;Else if rNumb&amp;lt;= 0.25 then control2='C';&lt;BR /&gt;else control2='T';&lt;BR /&gt;&lt;BR /&gt;end;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ERROR 22-322: Syntax error, expecting one of the following: a quoted string, a numeric constant, a datetime constant,&lt;BR /&gt;a missing value, iterator, (.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;ERROR 76-322: Syntax error, statement will be ignored.&lt;/P&gt;&lt;P&gt;ERROR 390-185: Expecting an relational or arithmetic operator.&lt;/P&gt;&lt;P&gt;ERROR 200-322: The symbol is not recognized and will be ignored.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 05 Oct 2018 02:05:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Unable-to-figure-error-in-else-if-then-statement/m-p/501719#M133813</guid>
      <dc:creator>girlieq97</dc:creator>
      <dc:date>2018-10-05T02:05:09Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to figure error in else if then statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Unable-to-figure-error-in-else-if-then-statement/m-p/501724#M133815</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt; data temp;
set dat.finger;


if missing=1 then do;
segmentation='mine';
rNumb2=ranuni(5678);
if rNumb2&amp;lt; 0.50 then sun=1;
else sun=2;

If control not in ('C','T') then rNumb=ranuni(1234);
If control='C' then control2='C';
Else if control='T' then control2='T';
Else if rNumb&amp;lt;= 0.25 then control2='C';
else control2='T';

end;

run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 05 Oct 2018 02:26:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Unable-to-figure-error-in-else-if-then-statement/m-p/501724#M133815</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-10-05T02:26:54Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to figure error in else if then statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Unable-to-figure-error-in-else-if-then-statement/m-p/501725#M133816</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/122688"&gt;@girlieq97&lt;/a&gt;try this code&lt;/P&gt;&lt;PRE&gt;data temp;&lt;BR /&gt;set dat.finger;&lt;BR /&gt;&lt;BR /&gt;if missing=1 then do;&lt;BR /&gt;segmentation='mine';&lt;BR /&gt;rNumb2=ranuni(5678);&lt;BR /&gt;if rNumb2&amp;lt; 0.50 then sun=1;&lt;BR /&gt;else sun=2;&lt;BR /&gt;If control not in ('C','T') then rNumb=ranuni(1234);&lt;BR /&gt;If control='C' then control2='C';&lt;BR /&gt;Else if control='T' then control2='T';&lt;BR /&gt;Else if rNumb&amp;lt;= 0.25 then control2='C';&lt;BR /&gt;else control2='T';&lt;BR /&gt;&lt;BR /&gt;end;&lt;BR /&gt;run;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;I think you were using the ` rather than the ' lol, small thing will get you.&lt;/P&gt;&lt;P&gt;`C'&amp;nbsp; and 'C' mean different things to SAS you mixed up the quoiting.&lt;/P&gt;</description>
      <pubDate>Fri, 05 Oct 2018 02:38:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Unable-to-figure-error-in-else-if-then-statement/m-p/501725#M133816</guid>
      <dc:creator>VDD</dc:creator>
      <dc:date>2018-10-05T02:38:10Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to figure error in else if then statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Unable-to-figure-error-in-else-if-then-statement/m-p/501730#M133818</link>
      <description>&lt;P&gt;thank you VDD for replying - omgosh something so simple! I reran it and now am getting&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;NOTE: Character values have been converted to numeric values at the places given by: (Line):(Column).&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 35:47&amp;nbsp;&amp;nbsp; 36:52&amp;nbsp;&amp;nbsp; 37:44&amp;nbsp;&amp;nbsp; 38:23&amp;nbsp;&amp;nbsp;&lt;BR /&gt;NOTE: Variable control is uninitialized.&lt;BR /&gt;NOTE: There were 0 observations read from the data set DAT.finger&lt;BR /&gt;NOTE: The data set WORK.TEMP has 0 observations and 256 variables.&lt;/P&gt;</description>
      <pubDate>Fri, 05 Oct 2018 02:43:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Unable-to-figure-error-in-else-if-then-statement/m-p/501730#M133818</guid>
      <dc:creator>girlieq97</dc:creator>
      <dc:date>2018-10-05T02:43:48Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to figure error in else if then statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Unable-to-figure-error-in-else-if-then-statement/m-p/501733#M133819</link>
      <description>&lt;P&gt;thank you - very much&lt;/P&gt;</description>
      <pubDate>Fri, 05 Oct 2018 02:44:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Unable-to-figure-error-in-else-if-then-statement/m-p/501733#M133819</guid>
      <dc:creator>girlieq97</dc:creator>
      <dc:date>2018-10-05T02:44:42Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to figure error in else if then statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Unable-to-figure-error-in-else-if-then-statement/m-p/501734#M133820</link>
      <description>&lt;P&gt;do you have a list of the variables in SAS dataset &lt;SPAN&gt;DAT.finger?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;is control in that list?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 05 Oct 2018 02:48:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Unable-to-figure-error-in-else-if-then-statement/m-p/501734#M133820</guid>
      <dc:creator>VDD</dc:creator>
      <dc:date>2018-10-05T02:48:51Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to figure error in else if then statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Unable-to-figure-error-in-else-if-then-statement/m-p/501735#M133821</link>
      <description>&lt;P&gt;the whole run takes 90 mins - this was the one piece that seemed to be holding me up so I was trying to figure it out in EG. I am going to try and run the whole code in Unix. I will let you know - I don't think control is showing in the dataset because it was erroring out at first. I will post again when run is done. thank you so much!!&lt;/P&gt;</description>
      <pubDate>Fri, 05 Oct 2018 02:52:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Unable-to-figure-error-in-else-if-then-statement/m-p/501735#M133821</guid>
      <dc:creator>girlieq97</dc:creator>
      <dc:date>2018-10-05T02:52:55Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to figure error in else if then statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Unable-to-figure-error-in-else-if-then-statement/m-p/501737#M133822</link>
      <description>&lt;P&gt;good luck.&lt;/P&gt;</description>
      <pubDate>Fri, 05 Oct 2018 02:55:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Unable-to-figure-error-in-else-if-then-statement/m-p/501737#M133822</guid>
      <dc:creator>VDD</dc:creator>
      <dc:date>2018-10-05T02:55:32Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to figure error in else if then statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Unable-to-figure-error-in-else-if-then-statement/m-p/501748#M133823</link>
      <description>no luck &lt;span class="lia-unicode-emoji" title=":confused_face:"&gt;😕&lt;/span&gt; control is missing from the dataset and another variable. It is already 10pm my time so going to call it a night and start fresh in the morning. thank you for your help though at least that is one less thing I have to worry about in the morning &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;</description>
      <pubDate>Fri, 05 Oct 2018 05:09:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Unable-to-figure-error-in-else-if-then-statement/m-p/501748#M133823</guid>
      <dc:creator>girlieq97</dc:creator>
      <dc:date>2018-10-05T05:09:08Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to figure error in else if then statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Unable-to-figure-error-in-else-if-then-statement/m-p/501753#M133825</link>
      <description>&lt;P&gt;The bad quotes are most probably an artifact caused by a word processor.&lt;/P&gt;
&lt;P&gt;NEVER use a word processor in programming, use text editors like notepad++ or the SAS Enhanced Editor.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Word processors may be used in documentation, but as a frontend for programming they are mostly useless.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Since I don't have dat.finger, I can't test it, but try&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data temp;
set dat.finger;
if missing = 1
then do;
  segmentation = 'mine';
  rNumb2 = ranuni(5678);
  if rNumb2 &amp;lt; 0.50
  then sun = 1;
  else sun = 2;
  if control in ('C','T')
  then control2 = control;
  else do;
    rNumb = ranuni(1234);
    if rNumb &amp;lt;= 0.25
    then control2 = 'C';
    else control2 = 'T';
  end;
end;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;and see if you get your desired result. I've tried to straighten out the unwieldy if-then-else tree that's often hard to maintain.&lt;/P&gt;</description>
      <pubDate>Fri, 05 Oct 2018 06:17:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Unable-to-figure-error-in-else-if-then-statement/m-p/501753#M133825</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-10-05T06:17:46Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to figure error in else if then statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Unable-to-figure-error-in-else-if-then-statement/m-p/501754#M133826</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/122688"&gt;@girlieq97&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;thank you VDD for replying - omgosh something so simple! I reran it and now am getting&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;NOTE: Character values have been converted to numeric values at the places given by: (Line):(Column).&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 35:47&amp;nbsp;&amp;nbsp; 36:52&amp;nbsp;&amp;nbsp; 37:44&amp;nbsp;&amp;nbsp; 38:23&amp;nbsp;&amp;nbsp;&lt;BR /&gt;NOTE: Variable control is uninitialized.&lt;BR /&gt;NOTE: There were 0 observations read from the data set DAT.finger&lt;BR /&gt;NOTE: The data set WORK.TEMP has 0 observations and 256 variables.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Maxim 3: know your data.&lt;/P&gt;
&lt;P&gt;Check if the variables that you want to use are there (proc contents, table view)&lt;/P&gt;
&lt;P&gt;Maxim 25: clean log, Maxim 31: computers are dumb&lt;/P&gt;
&lt;P&gt;After following Maxim 3, use variables correctly; if type conversions are necessary, do them explicitly yourself, so you have control over formats etc. Don't let that be done automatically, automatisms in software might change.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Since you do not have a where condition in your code, this also means that dat.finger has no observations. Which means that this step can never have run for 90 minutes, so your overall code has to be much larger, and an empty dataset points to a severe problem further up in the code. Clean out your code step-by-step from the top. Mark steps and use "run selected".&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 05 Oct 2018 06:26:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Unable-to-figure-error-in-else-if-then-statement/m-p/501754#M133826</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-10-05T06:26:03Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to figure error in else if then statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Unable-to-figure-error-in-else-if-then-statement/m-p/501945#M133915</link>
      <description>&lt;P&gt;Thank you for your help and observations. This was new code that I was adding to an already establish code run. So I was testing it outside of the larger code. You are absolutely right though I copied the code from a word document and I should have typed it out myself and I was not familiar with the data. I have gotten it to run correctly with the desired results since last night and am good to go this morning.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 05 Oct 2018 15:28:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Unable-to-figure-error-in-else-if-then-statement/m-p/501945#M133915</guid>
      <dc:creator>girlieq97</dc:creator>
      <dc:date>2018-10-05T15:28:10Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to figure error in else if then statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Unable-to-figure-error-in-else-if-then-statement/m-p/501960#M133924</link>
      <description>&lt;P&gt;&lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt; Great, it is nice to hear that you have that road-block removed from your path. &amp;nbsp;&lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 05 Oct 2018 15:48:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Unable-to-figure-error-in-else-if-then-statement/m-p/501960#M133924</guid>
      <dc:creator>VDD</dc:creator>
      <dc:date>2018-10-05T15:48:22Z</dc:date>
    </item>
  </channel>
</rss>

