<?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: What does this code fragment do, and what was the intention? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/What-does-this-code-fragment-do-and-what-was-the-intention/m-p/536353#M147390</link>
    <description>&lt;P&gt;You can only search for places further down the line where those two new variables are used, and try to infer from the use what they should contain.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You might find&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;they are never used and can safely be removed&lt;/LI&gt;
&lt;LI&gt;they are created with an incorrectly set length&lt;/LI&gt;
&lt;LI&gt;that it is actually expected that an underline separates the values, but in fact does not matter&lt;/LI&gt;
&lt;LI&gt;the dot instead of the underline causes an undetected problem and incorrect end results (or y'all were simply lucky)&lt;/LI&gt;
&lt;LI&gt;somebody already programmed around the dot caused by the missing numerical value&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;To me, such things are a sign that a re-thinking of the process and a re-coding is in order. SAS programs usually profit from a complete rewrite every ten years or so.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;Edit: fixed several typos caused by hypocaffeinosis&lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 18 Feb 2019 06:49:36 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2019-02-18T06:49:36Z</dc:date>
    <item>
      <title>What does this code fragment do, and what was the intention?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/What-does-this-code-fragment-do-and-what-was-the-intention/m-p/536306#M147361</link>
      <description>&lt;P&gt;Actually I know what it does, and I can guess what the intention was as well, but these variables are used throughout a whole process. Sadly, infuriatingly, it is quite hard to untangle. Hold on to your hats:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;id_fda= cats(of id _ year_fda); 
id_lda= cats(of id _ year_lda);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;As a hint, &lt;EM&gt;id&lt;/EM&gt;, &lt;EM&gt;year_fda &lt;/EM&gt;and &lt;EM&gt;year_lda&lt;/EM&gt; are defined variables from the previous step. But the other variable, ahem, &lt;EM&gt;_&lt;/EM&gt;, is not.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The cat family of functions is quite good at casting numeric variables to character, without warning messages and internal generation of inefficient code. As long as it knows about the variables from the dataset vector. When that variable (ahem - &lt;EM&gt;_&lt;/EM&gt;) is not defined it gets a little upset.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The intention was, we believe,&amp;nbsp;to strip and concatenate the &lt;EM&gt;id&lt;/EM&gt; and &lt;EM&gt;year_xxx&lt;/EM&gt; variables together, with a separator of '_'. If _ &lt;EM&gt;was&lt;/EM&gt; defined as character with the contents of '_', it would have worked. But instead (I feel unclean) its referenced as a &lt;EM&gt;numeric&lt;/EM&gt; variable with a missing value. This gets cast from numeric to character so that we now have &lt;EM&gt;id&lt;/EM&gt; and &lt;EM&gt;year_xxx&lt;/EM&gt; stripped and concatenated &lt;U&gt;&lt;STRONG&gt;&lt;EM&gt;with a #$&amp;gt;?@#$ '.' in between&lt;/EM&gt;&lt;/STRONG&gt;&lt;/U&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Someone get me a beer, please. I've seen some rubbish in the last forty years of SAS programming, but this takes the cake.&lt;/P&gt;</description>
      <pubDate>Mon, 18 Feb 2019 00:50:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/What-does-this-code-fragment-do-and-what-was-the-intention/m-p/536306#M147361</guid>
      <dc:creator>LaurieF</dc:creator>
      <dc:date>2019-02-18T00:50:20Z</dc:date>
    </item>
    <item>
      <title>Re: What does this code fragment do, and what was the intention?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/What-does-this-code-fragment-do-and-what-was-the-intention/m-p/536315#M147365</link>
      <description>My guess is it was supposed to be a hyphen instead of an underscore and got missed in the error checking process.</description>
      <pubDate>Mon, 18 Feb 2019 01:21:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/What-does-this-code-fragment-do-and-what-was-the-intention/m-p/536315#M147365</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-02-18T01:21:05Z</dc:date>
    </item>
    <item>
      <title>Re: What does this code fragment do, and what was the intention?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/What-does-this-code-fragment-do-and-what-was-the-intention/m-p/536316#M147366</link>
      <description>&lt;P&gt;&lt;CODE class=" language-sas"&gt;Yes this is&amp;nbsp;some confused code!&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&lt;CODE class=" language-sas"&gt;&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&lt;CODE class=" language-sas"&gt;I wonder why the coder used the list operator OF instead of a comma between variable names. OF makes it compulsory that everything else is a variable.&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&lt;CODE class=" language-sas"&gt;&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&lt;CODE class=" language-sas"&gt;Maybe we should have a community for "Creatively-Rabid-Abuse-of-Programming Code". Or maybe we should not...&amp;nbsp;&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&lt;CODE class=" language-sas"&gt;&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&lt;CODE class=" language-sas"&gt;&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 18 Feb 2019 01:21:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/What-does-this-code-fragment-do-and-what-was-the-intention/m-p/536316#M147366</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2019-02-18T01:21:33Z</dc:date>
    </item>
    <item>
      <title>Re: What does this code fragment do, and what was the intention?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/What-does-this-code-fragment-do-and-what-was-the-intention/m-p/536317#M147367</link>
      <description>&lt;P&gt;You're very kind. I'm going for incompetence.&lt;/P&gt;</description>
      <pubDate>Mon, 18 Feb 2019 01:23:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/What-does-this-code-fragment-do-and-what-was-the-intention/m-p/536317#M147367</guid>
      <dc:creator>LaurieF</dc:creator>
      <dc:date>2019-02-18T01:23:14Z</dc:date>
    </item>
    <item>
      <title>Re: What does this code fragment do, and what was the intention?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/What-does-this-code-fragment-do-and-what-was-the-intention/m-p/536319#M147369</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/17429"&gt;@LaurieF&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;You're very kind. I'm going for incompetence.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Just a more polite way of saying the same thing &lt;span class="lia-unicode-emoji" title=":winking_face:"&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>Mon, 18 Feb 2019 01:25:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/What-does-this-code-fragment-do-and-what-was-the-intention/m-p/536319#M147369</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-02-18T01:25:50Z</dc:date>
    </item>
    <item>
      <title>Re: What does this code fragment do, and what was the intention?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/What-does-this-code-fragment-do-and-what-was-the-intention/m-p/536320#M147370</link>
      <description>A wild guess....&lt;BR /&gt;&lt;BR /&gt;The _ was originally a double dash indicating a list of variables such as &lt;BR /&gt;&lt;BR /&gt;ID -- year_fda&lt;BR /&gt;&lt;BR /&gt;One text editing system converted two narrow dashes to one wide dash.  Then at a later point, a user noticed that a wide dash is an illegal name for a variable, and changed it to an underscore.</description>
      <pubDate>Mon, 18 Feb 2019 01:27:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/What-does-this-code-fragment-do-and-what-was-the-intention/m-p/536320#M147370</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2019-02-18T01:27:59Z</dc:date>
    </item>
    <item>
      <title>Re: What does this code fragment do, and what was the intention?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/What-does-this-code-fragment-do-and-what-was-the-intention/m-p/536331#M147376</link>
      <description>&lt;P&gt;I expect you're ascribing intention to incompetence.&lt;/P&gt;</description>
      <pubDate>Mon, 18 Feb 2019 02:39:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/What-does-this-code-fragment-do-and-what-was-the-intention/m-p/536331#M147376</guid>
      <dc:creator>LaurieF</dc:creator>
      <dc:date>2019-02-18T02:39:40Z</dc:date>
    </item>
    <item>
      <title>Re: What does this code fragment do, and what was the intention?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/What-does-this-code-fragment-do-and-what-was-the-intention/m-p/536332#M147377</link>
      <description>&lt;P&gt;As a general rule, people have good intentions.&amp;nbsp; But incompetence, coupled with a high energy level, can be a disaster.&lt;/P&gt;</description>
      <pubDate>Mon, 18 Feb 2019 02:49:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/What-does-this-code-fragment-do-and-what-was-the-intention/m-p/536332#M147377</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2019-02-18T02:49:33Z</dc:date>
    </item>
    <item>
      <title>Re: What does this code fragment do, and what was the intention?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/What-does-this-code-fragment-do-and-what-was-the-intention/m-p/536333#M147378</link>
      <description>&lt;P&gt;How about the possibility of : suffix to make it a list for OF to take effect?&lt;/P&gt;
&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;id_fda&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;cats&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;of &lt;SPAN class="token keyword"&gt;id&lt;/SPAN&gt;_year_fda:&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt; &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Btw, Beer does sound very nice. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 18 Feb 2019 03:15:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/What-does-this-code-fragment-do-and-what-was-the-intention/m-p/536333#M147378</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2019-02-18T03:15:17Z</dc:date>
    </item>
    <item>
      <title>Re: What does this code fragment do, and what was the intention?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/What-does-this-code-fragment-do-and-what-was-the-intention/m-p/536334#M147379</link>
      <description>&lt;P&gt;No, you've missed the horrible bit - there's spaces either side of the underscore. _ is a valid SAS variable name.&lt;/P&gt;</description>
      <pubDate>Mon, 18 Feb 2019 03:16:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/What-does-this-code-fragment-do-and-what-was-the-intention/m-p/536334#M147379</guid>
      <dc:creator>LaurieF</dc:creator>
      <dc:date>2019-02-18T03:16:51Z</dc:date>
    </item>
    <item>
      <title>Re: What does this code fragment do, and what was the intention?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/What-does-this-code-fragment-do-and-what-was-the-intention/m-p/536353#M147390</link>
      <description>&lt;P&gt;You can only search for places further down the line where those two new variables are used, and try to infer from the use what they should contain.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You might find&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;they are never used and can safely be removed&lt;/LI&gt;
&lt;LI&gt;they are created with an incorrectly set length&lt;/LI&gt;
&lt;LI&gt;that it is actually expected that an underline separates the values, but in fact does not matter&lt;/LI&gt;
&lt;LI&gt;the dot instead of the underline causes an undetected problem and incorrect end results (or y'all were simply lucky)&lt;/LI&gt;
&lt;LI&gt;somebody already programmed around the dot caused by the missing numerical value&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;To me, such things are a sign that a re-thinking of the process and a re-coding is in order. SAS programs usually profit from a complete rewrite every ten years or so.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;Edit: fixed several typos caused by hypocaffeinosis&lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 18 Feb 2019 06:49:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/What-does-this-code-fragment-do-and-what-was-the-intention/m-p/536353#M147390</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-02-18T06:49:36Z</dc:date>
    </item>
    <item>
      <title>Re: What does this code fragment do, and what was the intention?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/What-does-this-code-fragment-do-and-what-was-the-intention/m-p/536355#M147392</link>
      <description>&lt;P&gt;As I've pointed out before, there's only one variable I was concerned with, and that was the underscore one. I've been working at this site for a year, and I've constantly been struck by the lack of facility in reporting analysts who have been called on to do ETL work for which they are not equipped.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Occam's razor - you're overcomplicating things. It's lack of skill, backed up by lack of training, backed up by getting the wrong person to do the job.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;PS You don't want me doing maths…&lt;/P&gt;</description>
      <pubDate>Mon, 18 Feb 2019 06:44:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/What-does-this-code-fragment-do-and-what-was-the-intention/m-p/536355#M147392</guid>
      <dc:creator>LaurieF</dc:creator>
      <dc:date>2019-02-18T06:44:58Z</dc:date>
    </item>
  </channel>
</rss>

