<?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: Psuedo Code in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Psuedo-Code/m-p/463238#M117989</link>
    <description>&lt;P&gt;Giving that awful spaghetti code some visual structure (and removing several unnecessary brackets) makes understanding it much easier:&lt;/P&gt;
&lt;PRE&gt;sum (
  case
    when
      mod_r in ('02')
      and CAL IN ('P')
      and fec_in &amp;lt;= intnx('month', "PAR_FEC"d, -1, 'end')
      and EST not in ('7' '07' ' 7' '7 ' '70')
      and temp &amp;gt; 0
    then temp * SAL_OBL
    else . 
  end
) as con_temp&lt;/PRE&gt;
&lt;P&gt;You assign a sum (over several observations, possibly determined by a group by option) to a new variable named con_temp.&lt;/P&gt;
&lt;P&gt;This sum is built from the term "temp * SAL_OBL" whenever all the conditions in the when are met.&lt;/P&gt;
&lt;P&gt;Hint: this function&lt;/P&gt;
&lt;PRE&gt;intnx('month', "PAR_FEC"d, -1, 'end')&lt;/PRE&gt;
&lt;P&gt;won't work, as the text PAR_FEC is no valid SAS data literal. I suspect this should be a macro variable call &amp;amp;PAR_FEC instead.&lt;/P&gt;</description>
    <pubDate>Fri, 18 May 2018 07:59:04 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2018-05-18T07:59:04Z</dc:date>
    <item>
      <title>Psuedo Code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Psuedo-Code/m-p/463230#M117981</link>
      <description>&lt;P&gt;Can any one knows&amp;nbsp;how to convert below SAS to Pseudo code ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;SPAN&gt;&lt;EM&gt;&lt;STRONG&gt;sum&lt;/STRONG&gt;&lt;/EM&gt; ((&lt;EM&gt;&lt;STRONG&gt;case when&lt;/STRONG&gt;&lt;/EM&gt; (&lt;EM&gt;mod_r&lt;/EM&gt; in ('02') and CAL&lt;EM&gt; &lt;STRONG&gt;IN&lt;/STRONG&gt;&lt;/EM&gt; ('P') &lt;EM&gt;&lt;STRONG&gt;and&lt;/STRONG&gt;&lt;/EM&gt; &lt;EM&gt;fec_in &lt;STRONG&gt;&amp;lt;=&lt;/STRONG&gt;&lt;/EM&gt; intnx('month', "&lt;EM&gt;PAR_FEC"d&lt;/EM&gt;, -1, 'end') &lt;EM&gt;&lt;STRONG&gt;and&lt;/STRONG&gt; &lt;/EM&gt;EST &lt;EM&gt;&lt;STRONG&gt;not in&lt;/STRONG&gt;&lt;/EM&gt; ('7' '07' ' 7' '7 ' '70')&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;and &lt;EM&gt;temp&lt;/EM&gt;&amp;gt;0) &lt;EM&gt;&lt;STRONG&gt;then&lt;/STRONG&gt;&lt;/EM&gt; &lt;EM&gt;temp*SAL_OBL&lt;/EM&gt; else . end)) &lt;EM&gt;&lt;STRONG&gt;as&lt;/STRONG&gt;&lt;/EM&gt; con_temp.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 18 May 2018 07:23:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Psuedo-Code/m-p/463230#M117981</guid>
      <dc:creator>c4shiva</dc:creator>
      <dc:date>2018-05-18T07:23:54Z</dc:date>
    </item>
    <item>
      <title>Re: Psuedo Code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Psuedo-Code/m-p/463236#M117987</link>
      <description>&lt;P&gt;Pseudocode just means sort of code.&amp;nbsp; There is no defined standard for what that should be.&amp;nbsp; What you provide there could be pseudocode for how to write an if statement in a datastep for instance.&amp;nbsp; So no, there is no way to provide something you expect which only you know.&lt;/P&gt;</description>
      <pubDate>Fri, 18 May 2018 07:41:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Psuedo-Code/m-p/463236#M117987</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-05-18T07:41:57Z</dc:date>
    </item>
    <item>
      <title>Re: Psuedo Code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Psuedo-Code/m-p/463238#M117989</link>
      <description>&lt;P&gt;Giving that awful spaghetti code some visual structure (and removing several unnecessary brackets) makes understanding it much easier:&lt;/P&gt;
&lt;PRE&gt;sum (
  case
    when
      mod_r in ('02')
      and CAL IN ('P')
      and fec_in &amp;lt;= intnx('month', "PAR_FEC"d, -1, 'end')
      and EST not in ('7' '07' ' 7' '7 ' '70')
      and temp &amp;gt; 0
    then temp * SAL_OBL
    else . 
  end
) as con_temp&lt;/PRE&gt;
&lt;P&gt;You assign a sum (over several observations, possibly determined by a group by option) to a new variable named con_temp.&lt;/P&gt;
&lt;P&gt;This sum is built from the term "temp * SAL_OBL" whenever all the conditions in the when are met.&lt;/P&gt;
&lt;P&gt;Hint: this function&lt;/P&gt;
&lt;PRE&gt;intnx('month', "PAR_FEC"d, -1, 'end')&lt;/PRE&gt;
&lt;P&gt;won't work, as the text PAR_FEC is no valid SAS data literal. I suspect this should be a macro variable call &amp;amp;PAR_FEC instead.&lt;/P&gt;</description>
      <pubDate>Fri, 18 May 2018 07:59:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Psuedo-Code/m-p/463238#M117989</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-05-18T07:59:04Z</dc:date>
    </item>
    <item>
      <title>Re: Psuedo Code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Psuedo-Code/m-p/463737#M118194</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;SPAN class="login-bold"&gt;Kurtbremser,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Thanks a lot for your solution.&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>Mon, 21 May 2018 09:17:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Psuedo-Code/m-p/463737#M118194</guid>
      <dc:creator>c4shiva</dc:creator>
      <dc:date>2018-05-21T09:17:30Z</dc:date>
    </item>
  </channel>
</rss>

