<?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: Doubt in Trim portion in the below code in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Doubt-in-Trim-portion-in-the-below-code/m-p/323277#M71643</link>
    <description>&lt;P&gt;a) don't write program code in all capitals&lt;/P&gt;
&lt;P&gt;b) what's your doubt?&lt;/P&gt;</description>
    <pubDate>Mon, 09 Jan 2017 07:53:08 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2017-01-09T07:53:08Z</dc:date>
    <item>
      <title>Doubt in Trim portion in the below code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Doubt-in-Trim-portion-in-the-below-code/m-p/323274#M71639</link>
      <description>&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ARRAY SCD(*)&amp;nbsp;&amp;nbsp; SC001-SC500;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DO IS = 1 TO 500;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IF SUBSTR(SCD(IS),1,1) &amp;gt; "V" THEN I = 500;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ELSE&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IF SUBSTR(SCD(IS),1,1) = '*' THEN&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DO;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SUBSTR(TRIM,1,2) = SUBSTR(SCD(IS),2,2);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; TRIM1 = SUBSTR(SCD(IS),1,3);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; END;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ELSE&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IF SUBSTR(SCD(IS),1,1) = '-' THEN&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DO;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SUBSTR(TRIM,3,2) = SUBSTR(SCD(IS),2,2);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; TRIM2 = SUBSTR(SCD(IS),1,3);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; END;&lt;/P&gt;</description>
      <pubDate>Mon, 09 Jan 2017 07:45:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Doubt-in-Trim-portion-in-the-below-code/m-p/323274#M71639</guid>
      <dc:creator>GokulakrishnanSethuraman</dc:creator>
      <dc:date>2017-01-09T07:45:44Z</dc:date>
    </item>
    <item>
      <title>Re: Doubt in Trim portion in the below code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Doubt-in-Trim-portion-in-the-below-code/m-p/323277#M71643</link>
      <description>&lt;P&gt;a) don't write program code in all capitals&lt;/P&gt;
&lt;P&gt;b) what's your doubt?&lt;/P&gt;</description>
      <pubDate>Mon, 09 Jan 2017 07:53:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Doubt-in-Trim-portion-in-the-below-code/m-p/323277#M71643</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-01-09T07:53:08Z</dc:date>
    </item>
    <item>
      <title>Re: Doubt in Trim portion in the below code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Doubt-in-Trim-portion-in-the-below-code/m-p/323284#M71644</link>
      <description>&lt;P&gt;do you have doubt in below statement:&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;SUBSTR(TRIM,1,2) = SUBSTR(SCD(IS),2,2);&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;If yes, here, TRIM is a variable and you are replacing its first 2 bytes from he SCD array&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 09 Jan 2017 08:16:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Doubt-in-Trim-portion-in-the-below-code/m-p/323284#M71644</guid>
      <dc:creator>mnjtrana</dc:creator>
      <dc:date>2017-01-09T08:16:44Z</dc:date>
    </item>
    <item>
      <title>Re: Doubt in Trim portion in the below code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Doubt-in-Trim-portion-in-the-below-code/m-p/323307#M71648</link>
      <description>&lt;P&gt;What is the question here? &amp;nbsp;Post eaxmple test data, in the form of a datastep, and what you expect the output to be so that we can see what the process is. &amp;nbsp;Avoid coding in capitals as this makes code very hard to read. &amp;nbsp;Use the code blocks - it is a {I} above where you post, which moves code to a proper editor area. &amp;nbsp;It looks to me like you could simplfy your if branching down to one select:&lt;/P&gt;
&lt;PRE&gt;do is=1 to 500;
  select;
    when (substr(scd(is),1,1) &amp;gt; "V") i=500;
    when ...;
  end;
end;&lt;/PRE&gt;
&lt;P&gt;Do note, I would advise not doing the substr(scd(is),1,1) &amp;gt; "V", that isn't what I would call logical approach. &amp;nbsp;V is a character, it works as it also has an associated ASCII code, which is what you are comparing there, but that doesn't mean that "x" would be &amp;gt; "V" for instance. &amp;nbsp;I would say,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;upcase(substr(scd(is),1,1)) in ("W","X","Y","Z")&lt;/P&gt;
&lt;P&gt;would be a clearer way of writing it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Edit: &amp;nbsp;One other thing to add. &amp;nbsp;It always jumps out at me when someone states they have &amp;gt; 50 variables in a dataset. &amp;nbsp;My first question would always be why? &amp;nbsp;There are some instances of course where it is easier, and sometimes necessary to do it this way, however I find that most times many variables makes hard work. &amp;nbsp;It may be that your logic can be simplified merely by restructuring your data into a normalised form.&lt;/P&gt;</description>
      <pubDate>Mon, 09 Jan 2017 10:09:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Doubt-in-Trim-portion-in-the-below-code/m-p/323307#M71648</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-01-09T10:09:43Z</dc:date>
    </item>
  </channel>
</rss>

