<?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: An array for trim function in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/An-array-for-trim-function/m-p/217693#M40103</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;If you want to use explicit array references then you do have to actually be explicit in your references, so make sure the include the index value when you use the array name in a statement.&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;Plus you need to write the result back to the same variable if you want it to have any effect.&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;Note that you really don't need the (*) as SAS knows that you have listed the variables and can count them itself.&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;And the TRIM() function is doing nothing in this context.&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;array varnew var_1-var_44;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;do i=1 to dim(varnew);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;&amp;nbsp; varnew(i)&lt;/STRONG&gt;=compress(&lt;STRONG&gt;varnew(i)&lt;/STRONG&gt;, '.');&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;end;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;drop i;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 20 May 2015 20:53:21 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2015-05-20T20:53:21Z</dc:date>
    <item>
      <title>An array for trim function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/An-array-for-trim-function/m-p/217688#M40098</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need to take a '.' out of 44 variables: var_1-var_44 and would like to do this with an array. The following code is not working. Can you help me troubleshoot?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Data...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; length vrn $8.;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; array varnew (*) var_1-var_44;&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; do i=1 to dim(varnew);&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; vrn=compress(trim(vrn), '.');&lt;/P&gt;&lt;P&gt;&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; drop i;&lt;/P&gt;&lt;P&gt;....&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 May 2015 17:08:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/An-array-for-trim-function/m-p/217688#M40098</guid>
      <dc:creator>sarahsasuser</dc:creator>
      <dc:date>2015-05-20T17:08:59Z</dc:date>
    </item>
    <item>
      <title>Re: An array for trim function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/An-array-for-trim-function/m-p/217689#M40099</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You need to use VARNEW(I) to reference the current variable instead of VM.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Personally I would use DO OVER, but SAS is trying to remove that functionality.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;array varnew var_1-var_44 ;&lt;/P&gt;&lt;P&gt;do over varnew;&lt;/P&gt;&lt;P&gt; varnew=compress(varnew,'.');&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 May 2015 17:21:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/An-array-for-trim-function/m-p/217689#M40099</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2015-05-20T17:21:03Z</dc:date>
    </item>
    <item>
      <title>Re: An array for trim function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/An-array-for-trim-function/m-p/217690#M40100</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Just on a hunch ... is it possible that these variables are numeric rather than character?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 May 2015 17:34:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/An-array-for-trim-function/m-p/217690#M40100</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2015-05-20T17:34:05Z</dc:date>
    </item>
    <item>
      <title>Re: An array for trim function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/An-array-for-trim-function/m-p/217691#M40101</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Tom that worked. However, if SAS is getting rid of DO OVER, what other options are there? When I reference varnew&amp;nbsp; in the compress function without the DO OVER, I get an error that the varnew var can't be referenced here. Example:&lt;/P&gt;&lt;P&gt;array varnew (*) var_1-var_44;&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; do i=1 to dim(varnew);&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; vrn=compress(trim(varnew), '.');&lt;/P&gt;&lt;P&gt;&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; drop i;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 May 2015 18:52:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/An-array-for-trim-function/m-p/217691#M40101</guid>
      <dc:creator>sarahsasuser</dc:creator>
      <dc:date>2015-05-20T18:52:07Z</dc:date>
    </item>
    <item>
      <title>Re: An array for trim function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/An-array-for-trim-function/m-p/217692#M40102</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If using the explicit array step, the i= 1 to dim() then you have to use the Explicit array reference varnew&lt;I&gt;. &lt;/I&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 May 2015 20:23:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/An-array-for-trim-function/m-p/217692#M40102</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2015-05-20T20:23:48Z</dc:date>
    </item>
    <item>
      <title>Re: An array for trim function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/An-array-for-trim-function/m-p/217693#M40103</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;If you want to use explicit array references then you do have to actually be explicit in your references, so make sure the include the index value when you use the array name in a statement.&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;Plus you need to write the result back to the same variable if you want it to have any effect.&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;Note that you really don't need the (*) as SAS knows that you have listed the variables and can count them itself.&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;And the TRIM() function is doing nothing in this context.&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;array varnew var_1-var_44;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;do i=1 to dim(varnew);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;&amp;nbsp; varnew(i)&lt;/STRONG&gt;=compress(&lt;STRONG&gt;varnew(i)&lt;/STRONG&gt;, '.');&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;end;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;drop i;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 May 2015 20:53:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/An-array-for-trim-function/m-p/217693#M40103</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2015-05-20T20:53:21Z</dc:date>
    </item>
    <item>
      <title>Re: An array for trim function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/An-array-for-trim-function/m-p/217694#M40104</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Bingo&amp;nbsp; &lt;STRONG style="font-size: 12px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;A _jive_internal="true" class="jiveTT-hover-user jive-username-link" data-avatarid="-1" data-externalid="" data-presence="null" data-userid="5253" data-username="Astounding" href="https://communities.sas.com/people/Astounding" id="jive-525347675340759199186" style="padding: 0 3px 0 0; font-weight: inherit; font-style: inherit; font-size: 1.1em; font-family: inherit; color: #0e66ba;"&gt;Astounding&lt;/A&gt;&lt;/STRONG&gt;&amp;nbsp; &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;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 May 2015 12:05:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/An-array-for-trim-function/m-p/217694#M40104</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2015-05-22T12:05:04Z</dc:date>
    </item>
    <item>
      <title>Re: An array for trim function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/An-array-for-trim-function/m-p/217695#M40105</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Perhaps &lt;A __default_attr="645292" __jive_macro_name="user" class="jive_macro jive_macro_user" data-objecttype="3" href="https://communities.sas.com/"&gt;&lt;/A&gt; and &lt;A __default_attr="5253" __jive_macro_name="user" class="jive_macro jive_macro_user" data-objecttype="3" href="https://communities.sas.com/"&gt;&lt;/A&gt; could explain why character vs. numeric would make a difference in this case and what to do in the latter case? This is a character variable that I'm using in my example, but I'd be interested to know what I would need to change if I have a numeric variable in the future. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 May 2015 13:38:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/An-array-for-trim-function/m-p/217695#M40105</guid>
      <dc:creator>sarahsasuser</dc:creator>
      <dc:date>2015-05-22T13:38:12Z</dc:date>
    </item>
  </channel>
</rss>

