<?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: IF-THEN statement not working for all observations in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/IF-THEN-statement-not-working-for-all-observations/m-p/921242#M362787</link>
    <description>&lt;P&gt;Format your code better and the mistake might become more visible.&lt;/P&gt;
&lt;P&gt;First put only one statement per line.&lt;/P&gt;
&lt;P&gt;Consider the first 5 statements.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if physical1=1 then physical1_qol=100;
if physical1=2 then physical1_qol=75;
if physical1=3 then physical1_qol=50;
if physical1=4 then physical1_qol=25;
if physical1=5 then physical1_qol=0;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Now a human can scan them and make sure you haven't used different variable names or values somewhere that would explain how&amp;nbsp;a value of PHYSICAL1=1 would be confused with a value of PHYSiCAL1=4.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But you could also just code the conversion as a formula instead.&amp;nbsp; This one could be:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;physical1_qol=100-25*(physical1-1);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Or perhaps less obviously:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;physical1_qol=125-25*physical1;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;both of which is much less typing&amp;nbsp;(and so much less chance of typos)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Another way to reduce the typing&amp;nbsp; is to use arrays.&amp;nbsp; For that you probably should change the target variable names so the counter is at the END of the name so it can be used more easily in variable lists.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  set have;
  array raw physical1-physical8;
  array qol physical_qol1-physical_qol8;
  do index=1 to dim(raw);
     qol[index]=125-25*raw[index];
  end;
  drop index;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 21 Mar 2024 04:49:24 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2024-03-21T04:49:24Z</dc:date>
    <item>
      <title>IF-THEN statement not working for all observations</title>
      <link>https://communities.sas.com/t5/SAS-Programming/IF-THEN-statement-not-working-for-all-observations/m-p/921238#M362785</link>
      <description>&lt;P&gt;I am trying to derive the quality of life score based on the participants’ responses. I used the below-mentioned if-then statement to give the score.&amp;nbsp; There were two observations where this if/then statement was not correctly working. For example, even though physical1= 1, the physical1_qol was shown as 25 instead of 100. In both observations, there were missing values for physical_qol even though physical values were not missing.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;if physical1=&lt;STRONG&gt;1&lt;/STRONG&gt; then physical1_qol=&lt;STRONG&gt;100&lt;/STRONG&gt;;if physical1=&lt;STRONG&gt;2&lt;/STRONG&gt; then physical1_qol=&lt;STRONG&gt;75&lt;/STRONG&gt;;if physical1=&lt;STRONG&gt;3&lt;/STRONG&gt; then physical1_qol=&lt;STRONG&gt;50&lt;/STRONG&gt;;if physical1=&lt;STRONG&gt;4&lt;/STRONG&gt; then physical1_qol=&lt;STRONG&gt;25&lt;/STRONG&gt;;if physical1=&lt;STRONG&gt;5&lt;/STRONG&gt; then physical1_qol=&lt;STRONG&gt;0&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;if physical2=&lt;STRONG&gt;1&lt;/STRONG&gt; then physical2_qol=&lt;STRONG&gt;100&lt;/STRONG&gt;;if physical2=&lt;STRONG&gt;2&lt;/STRONG&gt; then physical2_qol=&lt;STRONG&gt;75&lt;/STRONG&gt;;if physical2=&lt;STRONG&gt;3&lt;/STRONG&gt; then physical2_qol=&lt;STRONG&gt;50&lt;/STRONG&gt;;if physical2=&lt;STRONG&gt;4&lt;/STRONG&gt; then physical2_qol=&lt;STRONG&gt;25&lt;/STRONG&gt;;if physical2=&lt;STRONG&gt;5&lt;/STRONG&gt; then physical2_qol=&lt;STRONG&gt;0&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;if physical3=&lt;STRONG&gt;1&lt;/STRONG&gt; then physical3_qol=&lt;STRONG&gt;100&lt;/STRONG&gt;;if physical3=&lt;STRONG&gt;2&lt;/STRONG&gt; then physical3_qol=&lt;STRONG&gt;75&lt;/STRONG&gt;;if physical3=&lt;STRONG&gt;3&lt;/STRONG&gt; then physical3_qol=&lt;STRONG&gt;50&lt;/STRONG&gt;;if physical3=&lt;STRONG&gt;4&lt;/STRONG&gt; then physical3_qol=&lt;STRONG&gt;25&lt;/STRONG&gt;;if physical3=&lt;STRONG&gt;5&lt;/STRONG&gt; then physical3_qol=&lt;STRONG&gt;0&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;if physical4=&lt;STRONG&gt;1&lt;/STRONG&gt; then physical4_qol=&lt;STRONG&gt;100&lt;/STRONG&gt;;if physical4=&lt;STRONG&gt;2&lt;/STRONG&gt; then physical4_qol=&lt;STRONG&gt;75&lt;/STRONG&gt;;if physical4=&lt;STRONG&gt;3&lt;/STRONG&gt; then physical4_qol=&lt;STRONG&gt;50&lt;/STRONG&gt;;if physical4=&lt;STRONG&gt;4&lt;/STRONG&gt; then physical4_qol=&lt;STRONG&gt;25&lt;/STRONG&gt;;if physical4=&lt;STRONG&gt;5&lt;/STRONG&gt; then physical4_qol=&lt;STRONG&gt;0&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;if physical5=&lt;STRONG&gt;1&lt;/STRONG&gt; then physical5_qol=&lt;STRONG&gt;100&lt;/STRONG&gt;;if physical5=&lt;STRONG&gt;2&lt;/STRONG&gt; then physical5_qol=&lt;STRONG&gt;75&lt;/STRONG&gt;;if physical5=&lt;STRONG&gt;3&lt;/STRONG&gt; then physical5_qol=&lt;STRONG&gt;50&lt;/STRONG&gt;;if physical5=&lt;STRONG&gt;4&lt;/STRONG&gt; then physical1_qol=&lt;STRONG&gt;25&lt;/STRONG&gt;;if physical5=&lt;STRONG&gt;5&lt;/STRONG&gt; then physical5_qol=&lt;STRONG&gt;0&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;if physical6=&lt;STRONG&gt;1&lt;/STRONG&gt; then physical6_qol=&lt;STRONG&gt;100&lt;/STRONG&gt;;if physical6=&lt;STRONG&gt;2&lt;/STRONG&gt; then physical6_qol=&lt;STRONG&gt;75&lt;/STRONG&gt;;if physical6=&lt;STRONG&gt;3&lt;/STRONG&gt; then physical6_qol=&lt;STRONG&gt;50&lt;/STRONG&gt;;if physical6=&lt;STRONG&gt;4&lt;/STRONG&gt; then physical6_qol=&lt;STRONG&gt;25&lt;/STRONG&gt;;if physical6=&lt;STRONG&gt;5&lt;/STRONG&gt; then physical6_qol=&lt;STRONG&gt;0&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;if physical7=&lt;STRONG&gt;1&lt;/STRONG&gt; then physical7_qol=&lt;STRONG&gt;100&lt;/STRONG&gt;;if physical7=&lt;STRONG&gt;2&lt;/STRONG&gt; then physical7_qol=&lt;STRONG&gt;75&lt;/STRONG&gt;;if physical7=&lt;STRONG&gt;3&lt;/STRONG&gt; then physical7_qol=&lt;STRONG&gt;50&lt;/STRONG&gt;;if physical7=&lt;STRONG&gt;4&lt;/STRONG&gt; then physical7_qol=&lt;STRONG&gt;25&lt;/STRONG&gt;;if physical7=&lt;STRONG&gt;5&lt;/STRONG&gt; then physical7_qol=&lt;STRONG&gt;0&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;if physical8=&lt;STRONG&gt;1&lt;/STRONG&gt; then physical8_qol=&lt;STRONG&gt;100&lt;/STRONG&gt;;if physical8=&lt;STRONG&gt;2&lt;/STRONG&gt; then physical8_qol=&lt;STRONG&gt;75&lt;/STRONG&gt;;if physical8=&lt;STRONG&gt;3&lt;/STRONG&gt; then physical8_qol=&lt;STRONG&gt;50&lt;/STRONG&gt;;if physical8=&lt;STRONG&gt;4&lt;/STRONG&gt; then physical8_qol=&lt;STRONG&gt;25&lt;/STRONG&gt;;if physical8=&lt;STRONG&gt;5&lt;/STRONG&gt; then physical8_qol=&lt;STRONG&gt;0&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Thu, 21 Mar 2024 03:30:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/IF-THEN-statement-not-working-for-all-observations/m-p/921238#M362785</guid>
      <dc:creator>Krishtee</dc:creator>
      <dc:date>2024-03-21T03:30:02Z</dc:date>
    </item>
    <item>
      <title>Re: IF-THEN statement not working for all observations</title>
      <link>https://communities.sas.com/t5/SAS-Programming/IF-THEN-statement-not-working-for-all-observations/m-p/921242#M362787</link>
      <description>&lt;P&gt;Format your code better and the mistake might become more visible.&lt;/P&gt;
&lt;P&gt;First put only one statement per line.&lt;/P&gt;
&lt;P&gt;Consider the first 5 statements.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if physical1=1 then physical1_qol=100;
if physical1=2 then physical1_qol=75;
if physical1=3 then physical1_qol=50;
if physical1=4 then physical1_qol=25;
if physical1=5 then physical1_qol=0;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Now a human can scan them and make sure you haven't used different variable names or values somewhere that would explain how&amp;nbsp;a value of PHYSICAL1=1 would be confused with a value of PHYSiCAL1=4.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But you could also just code the conversion as a formula instead.&amp;nbsp; This one could be:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;physical1_qol=100-25*(physical1-1);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Or perhaps less obviously:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;physical1_qol=125-25*physical1;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;both of which is much less typing&amp;nbsp;(and so much less chance of typos)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Another way to reduce the typing&amp;nbsp; is to use arrays.&amp;nbsp; For that you probably should change the target variable names so the counter is at the END of the name so it can be used more easily in variable lists.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  set have;
  array raw physical1-physical8;
  array qol physical_qol1-physical_qol8;
  do index=1 to dim(raw);
     qol[index]=125-25*raw[index];
  end;
  drop index;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 21 Mar 2024 04:49:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/IF-THEN-statement-not-working-for-all-observations/m-p/921242#M362787</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2024-03-21T04:49:24Z</dc:date>
    </item>
    <item>
      <title>Re: IF-THEN statement not working for all observations</title>
      <link>https://communities.sas.com/t5/SAS-Programming/IF-THEN-statement-not-working-for-all-observations/m-p/921245#M362789</link>
      <description>&lt;P&gt;Let's first create some sample have data:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have(drop=_:);
  array physical{8} 8;
  do _i=1 to 4;
    do _k=1 to dim(physical);
      physical[_k]=rand('integer',1,6);
      if _i=2 and _k=1 then physical[_k]=1.00000001;
      if _i=1 and _k=2 then physical[_k]=.;
    end;
    output;
  end;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Using this sample have data there are several ways to recode your values. Taking your approach to populate a new variable with if/then/ELSE statements using array processing leads to&amp;nbsp; less code that's easier to maintain.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want_1;
  set have;
  array physical_in{*}  physical1 - physical8;
  array physical_qol{8} 8;
  do i=1 to dim(physical_in);
         if physical_in[i]=1 then physical_qol[i]=100;
    else if physical_in[i]=2 then physical_qol[i]=75;
    else if physical_in[i]=3 then physical_qol[i]=50;
    else if physical_in[i]=4 then physical_qol[i]=25;
    else if physical_in[i]=5 then physical_qol[i]=0;
  end;
  keep physical_qol:;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;NB: If creating numbered variables always add the number at the end of the name because this will make it much easier to reference such variables later on (example: &lt;CODE class=" language-sas"&gt;keep physical_qol:;&lt;/CODE&gt;).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you just need the recoded values for display/printing then creating and applying a format is all you need.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format;
  value physical
    1=100
    2=75
    3=50
    4=25
    5=0
    other=.
    ;
run;

proc print data=have;
  format physical: physical.;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Instead of using if/then/else statements you can also use an informat for recoding values. This again can make maintenance much easier.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format;
  invalue physical
    1=100
    2=75
    3=50
    4=25
    5=0
    other=.
    ;
run;

data want_2;
  set have;
  array physical_in{*}  physical1 - physical8;
  array physical_qol{8} 8;
  do i=1 to dim(physical_in);
    physical_qol[i]=input(physical_in[i],physical.);
  end;
  keep physical_qol:;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And now for to the issue you actually raised. To further investigate which source values lead to unexpected missings you could use code as below.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc freq data=have;
  table physical1 - physical8 /missing missprint;
  format physical1 - physical8 best32.;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Patrick_0-1710998919132.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/94827i77AD15AB264D87C6/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Patrick_0-1710998919132.png" alt="Patrick_0-1710998919132.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Depending on the findings for your real data you then can amend your code for recoding values. Eventually you didn't consider another possible source value, or there is some unexpected fractional value and you need to first round()/floor() your source values or with a format/informat use the fuzz option or ....&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I haven't mentioned to just multiply your source values by 25 because I wanted to propose approaches that will work for any mapping of source to target values.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Mar 2024 05:33:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/IF-THEN-statement-not-working-for-all-observations/m-p/921245#M362789</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2024-03-21T05:33:42Z</dc:date>
    </item>
    <item>
      <title>Re: IF-THEN statement not working for all observations</title>
      <link>https://communities.sas.com/t5/SAS-Programming/IF-THEN-statement-not-working-for-all-observations/m-p/921255#M362795</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;at 1st view it seems there is an inconsistancy here:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if physical5=4 then physical1_qol=25;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;shouldn't it be&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if physical5=4 then physical5_qol=25;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;?&lt;/P&gt;</description>
      <pubDate>Thu, 21 Mar 2024 07:39:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/IF-THEN-statement-not-working-for-all-observations/m-p/921255#M362795</guid>
      <dc:creator>Oligolas</dc:creator>
      <dc:date>2024-03-21T07:39:02Z</dc:date>
    </item>
    <item>
      <title>Re: IF-THEN statement not working for all observations</title>
      <link>https://communities.sas.com/t5/SAS-Programming/IF-THEN-statement-not-working-for-all-observations/m-p/921278#M362808</link>
      <description>&lt;P&gt;Depending on the other variables in your dataset, I would transpose it to a long layout, which would then make the transformation step extremely simple.&lt;/P&gt;</description>
      <pubDate>Thu, 21 Mar 2024 11:56:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/IF-THEN-statement-not-working-for-all-observations/m-p/921278#M362808</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2024-03-21T11:56:02Z</dc:date>
    </item>
    <item>
      <title>Re: IF-THEN statement not working for all observations</title>
      <link>https://communities.sas.com/t5/SAS-Programming/IF-THEN-statement-not-working-for-all-observations/m-p/921304#M362813</link>
      <description>&lt;P&gt;Thank you all for the suggestion. I changed the if-then statement to if-then/else, then it worked.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;if physical1=&lt;STRONG&gt;1&lt;/STRONG&gt; then physical1_qol=&lt;STRONG&gt;100&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;else if physical1=&lt;STRONG&gt;2&lt;/STRONG&gt; then physical1_qol=&lt;STRONG&gt;75&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;else if physical1=&lt;STRONG&gt;3&lt;/STRONG&gt; then physical1_qol=&lt;STRONG&gt;50&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;else if physical1=&lt;STRONG&gt;4&lt;/STRONG&gt; then physical1_qol=&lt;STRONG&gt;25&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;else if physical1=&lt;STRONG&gt;5&lt;/STRONG&gt; then physical1_qol=&lt;STRONG&gt;0&lt;/STRONG&gt;;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Mar 2024 14:45:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/IF-THEN-statement-not-working-for-all-observations/m-p/921304#M362813</guid>
      <dc:creator>Krishtee</dc:creator>
      <dc:date>2024-03-21T14:45:29Z</dc:date>
    </item>
    <item>
      <title>Re: IF-THEN statement not working for all observations</title>
      <link>https://communities.sas.com/t5/SAS-Programming/IF-THEN-statement-not-working-for-all-observations/m-p/921422#M362873</link>
      <description>&lt;P&gt;With mutually exclusive conditions an ELSE adds clarity and improves performance a bit but it should not have any impact on which condition becomes true - which should only ever be one.&lt;/P&gt;
&lt;P&gt;Adding the ELSE might mask existing issues like the one in the code you shared.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Patrick_1-1711061774850.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/94858i54C4580D3BA5B99E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Patrick_1-1711061774850.png" alt="Patrick_1-1711061774850.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Mar 2024 22:56:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/IF-THEN-statement-not-working-for-all-observations/m-p/921422#M362873</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2024-03-21T22:56:26Z</dc:date>
    </item>
    <item>
      <title>Re: IF-THEN statement not working for all observations</title>
      <link>https://communities.sas.com/t5/SAS-Programming/IF-THEN-statement-not-working-for-all-observations/m-p/921426#M362877</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/12447"&gt;@Patrick&lt;/a&gt;&amp;nbsp;Note that informats convert text into values.&amp;nbsp; So you cannot use the to convert numbers into numbers.&amp;nbsp; You will first need to convert the numbers into text.&amp;nbsp; &amp;nbsp;Or you could just use the format you created before to convert the numbers into text and then use the normal numeric informat to convert that text into a number.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;physical_qol[i]=input(put(physical_in[i],physical.),32.);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 22 Mar 2024 00:13:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/IF-THEN-statement-not-working-for-all-observations/m-p/921426#M362877</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2024-03-22T00:13:14Z</dc:date>
    </item>
    <item>
      <title>Re: IF-THEN statement not working for all observations</title>
      <link>https://communities.sas.com/t5/SAS-Programming/IF-THEN-statement-not-working-for-all-observations/m-p/921431#M362880</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;&amp;nbsp;True and using input(put(...)) is certainly the cleanest way for doing this.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Using the numerical informat directly on a numerical variable will create a compiler note like&amp;nbsp;&lt;EM&gt;NOTE: Numeric values have been converted to character values at the places given by:&lt;/EM&gt; but you still end-up with a numerical variable and the desired recoded values.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format;
  invalue test 1=100;
run;

data test;
  num_have=1;
  num_want=input(num_have,test.);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Patrick_0-1711068430753.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/94860i1D0C2700078DDBFD/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Patrick_0-1711068430753.png" alt="Patrick_0-1711068430753.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 22 Mar 2024 00:47:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/IF-THEN-statement-not-working-for-all-observations/m-p/921431#M362880</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2024-03-22T00:47:17Z</dc:date>
    </item>
  </channel>
</rss>

