<?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 Problem if/else in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Problem-if-else/m-p/782793#M31933</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I realized in my dataset that some of my if/then were not taken , but I can't understand why, I hope you could enlighten me, excuse me in advance for this long messy code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data logique;&lt;BR /&gt;set propre;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;if Status='Executed' then do;&lt;/P&gt;&lt;P&gt;if missing(volunteer_execution) then volunteer_execution='E';&lt;BR /&gt;died='N';&lt;BR /&gt;suicide='N';&lt;BR /&gt;released='N';&lt;BR /&gt;commuted='N';&lt;BR /&gt;reduction_de_peine='N';&lt;BR /&gt;current_sentence='DR';&lt;BR /&gt;if missing(exonerated)=1 then exonerated='E';&lt;BR /&gt;if missing(resentenced)=1 then resentenced='E';&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;else if Status='On Death Row' then do;&lt;/P&gt;&lt;P&gt;volunteer_execution='N';&lt;BR /&gt;died='N';&lt;BR /&gt;released='N';&lt;BR /&gt;suicide='N';&lt;BR /&gt;commuted='N';&lt;BR /&gt;reduction_de_peine='N';&lt;BR /&gt;current_sentence='DR';&lt;BR /&gt;exonerated='N';&lt;BR /&gt;if missing(resentenced)=1 then resentenced='E';&lt;BR /&gt;end;&lt;/P&gt;&lt;P&gt;else if Status='Not Currently On Death Row' then do;&lt;BR /&gt;released='N';&lt;BR /&gt;exonerated='N';&lt;BR /&gt;volunteer_execution='N';&lt;BR /&gt;if missing(died)=1 then died='E';&lt;BR /&gt;if missing(suicide)=1 then suicide='E';&lt;BR /&gt;if missing(commuted)=1 then commuted='E';&lt;BR /&gt;if missing(resentenced)=1 then resentenced='E';&lt;BR /&gt;if missing(current_sentence)=1 then current_sentence='DR';&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;end;&lt;BR /&gt;else if Status='Outside' then do;&lt;BR /&gt;died='N';&lt;BR /&gt;suicide='N';&lt;BR /&gt;volunteer_execution='N';&lt;BR /&gt;if missing(commuted)=1 then commuted='E';&lt;BR /&gt;&lt;BR /&gt;if (exonerated='Y')+(resentenced^='Y')=2 then resentenced='N';&lt;BR /&gt;if exonerated^='Y' then resentenced='Y';&lt;BR /&gt;if missing(current_sentence)=1 then current_sentence='E';&lt;BR /&gt;if exonerated^='Y' then exonerated='E';&lt;BR /&gt;if exonerated='Y' then reduction_de_peine='L';&lt;BR /&gt;if missing(resentenced)=1 then resentenced='E';&lt;BR /&gt;end;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;PART 2&lt;/P&gt;&lt;P&gt;data lib.final_table;&amp;nbsp;&lt;BR /&gt;set logique;&lt;/P&gt;&lt;P&gt;if commuted='Y' then reduction_de_peine='Y';&lt;BR /&gt;if resentenced^='Y' and current_sentence not in(' ','DR') then resentenced='Y';&lt;BR /&gt;if (resentenced='Y')+(current_sentence not in('DR',' '))=2 then reduction_de_peine='Y';&lt;BR /&gt;if reduction_de_peine='Y' then resentenced='Y';&lt;/P&gt;&lt;P&gt;if Status='Not Currently On Death Row' then do;/*Nous y voila*/&lt;/P&gt;&lt;P&gt;if (resentenced^='Y')+(died='Y')+(current_sentence='E')=3 then current_sentence='DR';&lt;BR /&gt;if (reduction_de_peine^='Y') and died^='Y' then do;&lt;BR /&gt;released='Y';&lt;BR /&gt;exonerated='Y';&lt;BR /&gt;end;&amp;nbsp;&lt;BR /&gt;if (released='Y')+(reduction_de_peine^='Y')=2 then do;&lt;BR /&gt;&lt;BR /&gt;exonerated='Y';&lt;BR /&gt;end;&lt;BR /&gt;if (released='Y')+(exonerated^='Y') then do;&amp;nbsp;&lt;BR /&gt;reduction_de_peine='Y';&lt;BR /&gt;resentenced='Y';&lt;BR /&gt;end;&lt;BR /&gt;if (released='Y')+(reduction_de_peine^='N')+(current_sentence='E')=3 then current_sentence='DR';&amp;nbsp;&lt;BR /&gt;if (reduction_de_peine='Y')+missing(died)=2 then do;&lt;BR /&gt;died='N';&lt;BR /&gt;suicide='N';&lt;BR /&gt;end;&lt;BR /&gt;if (resentenced='E')+(died='Y')=2 then resentenced='N';&lt;BR /&gt;end;&lt;BR /&gt;&lt;BR /&gt;if (resentenced='Y')+(Status in ('On Death Row','Executed'))=2 then reduction_de_peine='N';&lt;BR /&gt;if suicide='N' then died='N';&lt;BR /&gt;&lt;BR /&gt;if (reduction_de_peine='Y')+(exonerated='E')=2 then exonerated='N';&lt;BR /&gt;if missing(volunteer_execution)=1 then volunteer_execution='E';&lt;BR /&gt;/* je renvoi les gens released ou exonerated en Outside*/&lt;BR /&gt;if released='Y' or exonerated='Y' then Status='Outside';&lt;BR /&gt;if exonerated='Y' then released='I';&lt;BR /&gt;format volunteer_execution died suicide commuted exonerated resentenced released reduction_de_peine $modal.;&lt;BR /&gt;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ps:&amp;nbsp;Beyond the real problem, if you have an idea of code optimization I am listening!&lt;/P&gt;</description>
    <pubDate>Sun, 28 Nov 2021 23:23:49 GMT</pubDate>
    <dc:creator>oussama2</dc:creator>
    <dc:date>2021-11-28T23:23:49Z</dc:date>
    <item>
      <title>Problem if/else</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Problem-if-else/m-p/782793#M31933</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I realized in my dataset that some of my if/then were not taken , but I can't understand why, I hope you could enlighten me, excuse me in advance for this long messy code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data logique;&lt;BR /&gt;set propre;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;if Status='Executed' then do;&lt;/P&gt;&lt;P&gt;if missing(volunteer_execution) then volunteer_execution='E';&lt;BR /&gt;died='N';&lt;BR /&gt;suicide='N';&lt;BR /&gt;released='N';&lt;BR /&gt;commuted='N';&lt;BR /&gt;reduction_de_peine='N';&lt;BR /&gt;current_sentence='DR';&lt;BR /&gt;if missing(exonerated)=1 then exonerated='E';&lt;BR /&gt;if missing(resentenced)=1 then resentenced='E';&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;else if Status='On Death Row' then do;&lt;/P&gt;&lt;P&gt;volunteer_execution='N';&lt;BR /&gt;died='N';&lt;BR /&gt;released='N';&lt;BR /&gt;suicide='N';&lt;BR /&gt;commuted='N';&lt;BR /&gt;reduction_de_peine='N';&lt;BR /&gt;current_sentence='DR';&lt;BR /&gt;exonerated='N';&lt;BR /&gt;if missing(resentenced)=1 then resentenced='E';&lt;BR /&gt;end;&lt;/P&gt;&lt;P&gt;else if Status='Not Currently On Death Row' then do;&lt;BR /&gt;released='N';&lt;BR /&gt;exonerated='N';&lt;BR /&gt;volunteer_execution='N';&lt;BR /&gt;if missing(died)=1 then died='E';&lt;BR /&gt;if missing(suicide)=1 then suicide='E';&lt;BR /&gt;if missing(commuted)=1 then commuted='E';&lt;BR /&gt;if missing(resentenced)=1 then resentenced='E';&lt;BR /&gt;if missing(current_sentence)=1 then current_sentence='DR';&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;end;&lt;BR /&gt;else if Status='Outside' then do;&lt;BR /&gt;died='N';&lt;BR /&gt;suicide='N';&lt;BR /&gt;volunteer_execution='N';&lt;BR /&gt;if missing(commuted)=1 then commuted='E';&lt;BR /&gt;&lt;BR /&gt;if (exonerated='Y')+(resentenced^='Y')=2 then resentenced='N';&lt;BR /&gt;if exonerated^='Y' then resentenced='Y';&lt;BR /&gt;if missing(current_sentence)=1 then current_sentence='E';&lt;BR /&gt;if exonerated^='Y' then exonerated='E';&lt;BR /&gt;if exonerated='Y' then reduction_de_peine='L';&lt;BR /&gt;if missing(resentenced)=1 then resentenced='E';&lt;BR /&gt;end;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;PART 2&lt;/P&gt;&lt;P&gt;data lib.final_table;&amp;nbsp;&lt;BR /&gt;set logique;&lt;/P&gt;&lt;P&gt;if commuted='Y' then reduction_de_peine='Y';&lt;BR /&gt;if resentenced^='Y' and current_sentence not in(' ','DR') then resentenced='Y';&lt;BR /&gt;if (resentenced='Y')+(current_sentence not in('DR',' '))=2 then reduction_de_peine='Y';&lt;BR /&gt;if reduction_de_peine='Y' then resentenced='Y';&lt;/P&gt;&lt;P&gt;if Status='Not Currently On Death Row' then do;/*Nous y voila*/&lt;/P&gt;&lt;P&gt;if (resentenced^='Y')+(died='Y')+(current_sentence='E')=3 then current_sentence='DR';&lt;BR /&gt;if (reduction_de_peine^='Y') and died^='Y' then do;&lt;BR /&gt;released='Y';&lt;BR /&gt;exonerated='Y';&lt;BR /&gt;end;&amp;nbsp;&lt;BR /&gt;if (released='Y')+(reduction_de_peine^='Y')=2 then do;&lt;BR /&gt;&lt;BR /&gt;exonerated='Y';&lt;BR /&gt;end;&lt;BR /&gt;if (released='Y')+(exonerated^='Y') then do;&amp;nbsp;&lt;BR /&gt;reduction_de_peine='Y';&lt;BR /&gt;resentenced='Y';&lt;BR /&gt;end;&lt;BR /&gt;if (released='Y')+(reduction_de_peine^='N')+(current_sentence='E')=3 then current_sentence='DR';&amp;nbsp;&lt;BR /&gt;if (reduction_de_peine='Y')+missing(died)=2 then do;&lt;BR /&gt;died='N';&lt;BR /&gt;suicide='N';&lt;BR /&gt;end;&lt;BR /&gt;if (resentenced='E')+(died='Y')=2 then resentenced='N';&lt;BR /&gt;end;&lt;BR /&gt;&lt;BR /&gt;if (resentenced='Y')+(Status in ('On Death Row','Executed'))=2 then reduction_de_peine='N';&lt;BR /&gt;if suicide='N' then died='N';&lt;BR /&gt;&lt;BR /&gt;if (reduction_de_peine='Y')+(exonerated='E')=2 then exonerated='N';&lt;BR /&gt;if missing(volunteer_execution)=1 then volunteer_execution='E';&lt;BR /&gt;/* je renvoi les gens released ou exonerated en Outside*/&lt;BR /&gt;if released='Y' or exonerated='Y' then Status='Outside';&lt;BR /&gt;if exonerated='Y' then released='I';&lt;BR /&gt;format volunteer_execution died suicide commuted exonerated resentenced released reduction_de_peine $modal.;&lt;BR /&gt;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ps:&amp;nbsp;Beyond the real problem, if you have an idea of code optimization I am listening!&lt;/P&gt;</description>
      <pubDate>Sun, 28 Nov 2021 23:23:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Problem-if-else/m-p/782793#M31933</guid>
      <dc:creator>oussama2</dc:creator>
      <dc:date>2021-11-28T23:23:49Z</dc:date>
    </item>
    <item>
      <title>Re: Problem if/else</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Problem-if-else/m-p/782794#M31934</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/377024"&gt;@oussama2&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I realized in my dataset that some of my if/then were not taken , but I can't understand why, I hope you could enlighten me, excuse me in advance for this long messy code.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Be specific. Show us the exact parts of the code that you think should be executing, that are not executing (make them appear in red text, for example).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Show us a portion of the data as SAS data step code (&lt;A href="https://blogs.sas.com/content/sastraining/2016/03/11/jedi-sas-tricks-data-to-data-step-macro/" target="_self"&gt;instructions&lt;/A&gt;). Show us the desired output from this portion of the data.&lt;/P&gt;</description>
      <pubDate>Sun, 28 Nov 2021 23:37:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Problem-if-else/m-p/782794#M31934</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-11-28T23:37:06Z</dc:date>
    </item>
    <item>
      <title>Re: Problem if/else</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Problem-if-else/m-p/782798#M31935</link>
      <description>There are several things that are not taken into account, for example for Status='Outside' I specified died='N' but when I print the final result I see died='E' while I have not made any change in the rest of the code, and there are several problems of this type.&lt;BR /&gt;&lt;BR /&gt;I think that the problem is my understanding of the if/then statement, in which case it is necessary to put else? and in a then do; is it possible to put condition, in fact since my code seemed good I do not know where the problem comes from that's why I decided to post it.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Sun, 28 Nov 2021 23:57:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Problem-if-else/m-p/782798#M31935</guid>
      <dc:creator>oussama2</dc:creator>
      <dc:date>2021-11-28T23:57:30Z</dc:date>
    </item>
    <item>
      <title>Re: Problem if/else</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Problem-if-else/m-p/782800#M31936</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/377024"&gt;@oussama2&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;There are several things that are not taken into account, for example for &lt;FONT color="#FF0000"&gt;Status='Outside' I specified died='N'&lt;/FONT&gt; but when I print the final result I see died='E' while I have not made any change in the rest of the code, and there are several problems of this type.&lt;BR /&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;This snippet of code does not appear in the code you provided. So again, I ask that you highlight your code in red to indicate what parts of the code you think are not executing.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, do not ignore my request to see a portion of the data, and do not ignore the instructions I gave for providing the data. It's really really difficult to figure these things out without the additional information that I requested.&lt;/P&gt;</description>
      <pubDate>Mon, 29 Nov 2021 00:03:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Problem-if-else/m-p/782800#M31936</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-11-29T00:03:10Z</dc:date>
    </item>
    <item>
      <title>Re: Problem if/else</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Problem-if-else/m-p/782822#M31940</link>
      <description>&lt;P&gt;Please post formatted code using the running-man icon and some data that we have something to work with.&lt;/P&gt;</description>
      <pubDate>Mon, 29 Nov 2021 06:24:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Problem-if-else/m-p/782822#M31940</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2021-11-29T06:24:06Z</dc:date>
    </item>
  </channel>
</rss>

