<?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 if statement do not work HELP!!!! in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/if-statement-do-not-work-HELP/m-p/593343#M170257</link>
    <description>&lt;P&gt;Good day friends:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am using some if statements to compare data between 2 lines and put it in a third one, as follows:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data want;&lt;BR /&gt;set have;&lt;BR /&gt;if A = B then B = C;&lt;BR /&gt;if A &amp;gt; 0 and B = "." then C = A;&lt;BR /&gt;if B &amp;gt; 0 and A = "." then C = B;&lt;BR /&gt;RUN;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But, when i open the result, SAS seem to do not recognize as same values, i am attaching the picture to you to see that SAS is not recognizing it as the same.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My hypothesis is that the values in line A and B are not similar, or 1 of them is considered as character and not numeric, could you help me to solve it please?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;thank you .&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is thete any code to&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot from 2019-10-02 09-35-55.png" style="width: 584px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/32910iABD41F786E4C0C2A/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot from 2019-10-02 09-35-55.png" alt="Screenshot from 2019-10-02 09-35-55.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 02 Oct 2019 13:00:40 GMT</pubDate>
    <dc:creator>jonatan_velarde</dc:creator>
    <dc:date>2019-10-02T13:00:40Z</dc:date>
    <item>
      <title>if statement do not work HELP!!!!</title>
      <link>https://communities.sas.com/t5/SAS-Programming/if-statement-do-not-work-HELP/m-p/593343#M170257</link>
      <description>&lt;P&gt;Good day friends:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am using some if statements to compare data between 2 lines and put it in a third one, as follows:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data want;&lt;BR /&gt;set have;&lt;BR /&gt;if A = B then B = C;&lt;BR /&gt;if A &amp;gt; 0 and B = "." then C = A;&lt;BR /&gt;if B &amp;gt; 0 and A = "." then C = B;&lt;BR /&gt;RUN;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But, when i open the result, SAS seem to do not recognize as same values, i am attaching the picture to you to see that SAS is not recognizing it as the same.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My hypothesis is that the values in line A and B are not similar, or 1 of them is considered as character and not numeric, could you help me to solve it please?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;thank you .&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is thete any code to&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot from 2019-10-02 09-35-55.png" style="width: 584px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/32910iABD41F786E4C0C2A/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot from 2019-10-02 09-35-55.png" alt="Screenshot from 2019-10-02 09-35-55.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 02 Oct 2019 13:00:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/if-statement-do-not-work-HELP/m-p/593343#M170257</guid>
      <dc:creator>jonatan_velarde</dc:creator>
      <dc:date>2019-10-02T13:00:40Z</dc:date>
    </item>
    <item>
      <title>Re: if statement do not work HELP!!!!</title>
      <link>https://communities.sas.com/t5/SAS-Programming/if-statement-do-not-work-HELP/m-p/593344#M170258</link>
      <description>&lt;P&gt;If A and B are numeric variables (and not character variables), then remove the quotes or double-quotes from your code.&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;If you are not sure whether they are numeric or character, please run PROC CONTENTS on your data set HAVE.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Some of us will not (or cannot) open Microsoft Office documents, as they are a security risk. In the future, it would be better if you included the graphic or screen capture that you want us to see directly in your reply, via clicking on the "Photos" icon when you type your reply (even though technically, you don't really have a "photo" as George Eastman would recognize the term "photo")&lt;/P&gt;</description>
      <pubDate>Wed, 02 Oct 2019 12:50:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/if-statement-do-not-work-HELP/m-p/593344#M170258</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-10-02T12:50:29Z</dc:date>
    </item>
    <item>
      <title>Re: if statement do not work HELP!!!!</title>
      <link>https://communities.sas.com/t5/SAS-Programming/if-statement-do-not-work-HELP/m-p/593345#M170259</link>
      <description>still does not work</description>
      <pubDate>Wed, 02 Oct 2019 12:49:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/if-statement-do-not-work-HELP/m-p/593345#M170259</guid>
      <dc:creator>jonatan_velarde</dc:creator>
      <dc:date>2019-10-02T12:49:04Z</dc:date>
    </item>
    <item>
      <title>Re: if statement do not work HELP!!!!</title>
      <link>https://communities.sas.com/t5/SAS-Programming/if-statement-do-not-work-HELP/m-p/593346#M170260</link>
      <description>All variables are numeric</description>
      <pubDate>Wed, 02 Oct 2019 12:52:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/if-statement-do-not-work-HELP/m-p/593346#M170260</guid>
      <dc:creator>jonatan_velarde</dc:creator>
      <dc:date>2019-10-02T12:52:11Z</dc:date>
    </item>
    <item>
      <title>Re: if statement do not work HELP!!!!</title>
      <link>https://communities.sas.com/t5/SAS-Programming/if-statement-do-not-work-HELP/m-p/593347#M170261</link>
      <description>&lt;P&gt;What does PROC CONTENTS say about whether these variables are numeric or character?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Show us the LOG of your code, including the code and any ERROR message. Please maintain the formatting of the log by clicking on the {i} icon and pasting the log into that window —&amp;nbsp;&lt;STRONG&gt;do not skip this step.&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 02 Oct 2019 12:52:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/if-statement-do-not-work-HELP/m-p/593347#M170261</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-10-02T12:52:56Z</dc:date>
    </item>
    <item>
      <title>Re: if statement do not work HELP!!!!</title>
      <link>https://communities.sas.com/t5/SAS-Programming/if-statement-do-not-work-HELP/m-p/593348#M170262</link>
      <description>&lt;P&gt;Please post the log as text using the window opening by clicking on the {i}-button to preserve formatting. Screenshots are best added by using the "Photos"-Icon. Attaching office-files is almost always not helpful at all, because many users won't open those files, due to security restrictions.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 02 Oct 2019 12:53:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/if-statement-do-not-work-HELP/m-p/593348#M170262</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2019-10-02T12:53:06Z</dc:date>
    </item>
    <item>
      <title>Re: if statement do not work HELP!!!!</title>
      <link>https://communities.sas.com/t5/SAS-Programming/if-statement-do-not-work-HELP/m-p/593350#M170263</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/50712"&gt;@jonatan_velarde&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;All variables are numeric&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;The why to do compare with "."? Removing the quotes should help.&lt;/P&gt;</description>
      <pubDate>Wed, 02 Oct 2019 12:53:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/if-statement-do-not-work-HELP/m-p/593350#M170263</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2019-10-02T12:53:42Z</dc:date>
    </item>
    <item>
      <title>Re: if statement do not work HELP!!!!</title>
      <link>https://communities.sas.com/t5/SAS-Programming/if-statement-do-not-work-HELP/m-p/593354#M170264</link>
      <description>&lt;P&gt;Two numerical values that are &lt;EM&gt;visually&lt;/EM&gt; the same do not have to be that in reality. Calculations can cause very small differences because of the way computers store fractional numbers, and how that is influenced by the sequence of calculations.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So if the numbers are visually the same, apply rounding to make them same:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
set have;
a = round(a,.1);
b = round(b,.1);
if A = B then B = C;
if A &amp;gt; 0 and B = . then C = A;
if B &amp;gt; 0 and A = . then C = B;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Note use of the correct symbol for missing numeric values. "." is a character value.&lt;/P&gt;</description>
      <pubDate>Wed, 02 Oct 2019 13:00:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/if-statement-do-not-work-HELP/m-p/593354#M170264</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-10-02T13:00:39Z</dc:date>
    </item>
    <item>
      <title>Re: if statement do not work HELP!!!!</title>
      <link>https://communities.sas.com/t5/SAS-Programming/if-statement-do-not-work-HELP/m-p/593355#M170265</link>
      <description>&lt;P&gt;PS if you want to give us data for testing, supply it in usable form, in a data step with datalines. This way we can create an exact copy of your dataset with copy/paste and submit.&lt;/P&gt;</description>
      <pubDate>Wed, 02 Oct 2019 13:03:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/if-statement-do-not-work-HELP/m-p/593355#M170265</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-10-02T13:03:08Z</dc:date>
    </item>
    <item>
      <title>Re: if statement do not work HELP!!!!</title>
      <link>https://communities.sas.com/t5/SAS-Programming/if-statement-do-not-work-HELP/m-p/593356#M170266</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/15475"&gt;@andreas_lds&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Please post the log as text using the window opening by clicking on the {i}-button to preserve formatting. Screenshots are best added by using the "Photos"-Icon. Attaching office-files is almost always not helpful at all, because many users won't open those files, due to security restrictions.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;And word processors will invariably mangle text up to being unusable (UTF, special symbols like curly quotes etc)&lt;/P&gt;</description>
      <pubDate>Wed, 02 Oct 2019 13:04:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/if-statement-do-not-work-HELP/m-p/593356#M170266</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-10-02T13:04:58Z</dc:date>
    </item>
  </channel>
</rss>

