<?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 array and trim in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/array-and-trim/m-p/266590#M52572</link>
    <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have&amp;nbsp;20 variables &lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;SPAN&gt;&lt;STRONG&gt;itinerary_cab_1_sc &amp;nbsp; itinerary_cab_2_sc.....itinerary_cab_20_sc &lt;/STRONG&gt;&lt;/SPAN&gt;and I need to use them in a array,&amp;nbsp;but the array &amp;nbsp;only works when I&amp;nbsp; rename these &amp;nbsp;variables into something&amp;nbsp; like&amp;nbsp;&amp;nbsp;&amp;nbsp;cab_1 cab_2..... cab_20 . Is there a way to use the original variables without renaming them?&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 27 Apr 2016 01:24:56 GMT</pubDate>
    <dc:creator>archibald</dc:creator>
    <dc:date>2016-04-27T01:24:56Z</dc:date>
    <item>
      <title>array and trim</title>
      <link>https://communities.sas.com/t5/SAS-Programming/array-and-trim/m-p/266590#M52572</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have&amp;nbsp;20 variables &lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;SPAN&gt;&lt;STRONG&gt;itinerary_cab_1_sc &amp;nbsp; itinerary_cab_2_sc.....itinerary_cab_20_sc &lt;/STRONG&gt;&lt;/SPAN&gt;and I need to use them in a array,&amp;nbsp;but the array &amp;nbsp;only works when I&amp;nbsp; rename these &amp;nbsp;variables into something&amp;nbsp; like&amp;nbsp;&amp;nbsp;&amp;nbsp;cab_1 cab_2..... cab_20 . Is there a way to use the original variables without renaming them?&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 27 Apr 2016 01:24:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/array-and-trim/m-p/266590#M52572</guid>
      <dc:creator>archibald</dc:creator>
      <dc:date>2016-04-27T01:24:56Z</dc:date>
    </item>
    <item>
      <title>Re: array and trim</title>
      <link>https://communities.sas.com/t5/SAS-Programming/array-and-trim/m-p/266595#M52577</link>
      <description>&lt;P&gt;Absolutely, you can use arrays with the original variable names.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But if you want help fixing your program, you will need to show the program.&lt;/P&gt;</description>
      <pubDate>Wed, 27 Apr 2016 01:50:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/array-and-trim/m-p/266595#M52577</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2016-04-27T01:50:36Z</dc:date>
    </item>
    <item>
      <title>Re: array and trim</title>
      <link>https://communities.sas.com/t5/SAS-Programming/array-and-trim/m-p/266598#M52580</link>
      <description>&lt;P&gt;&lt;FONT face="comic sans ms,sans-serif"&gt;You can create an array out of variables already defined, someting like&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; array c1-c20 &amp;nbsp; &amp;nbsp;itinerary_cab_1_s &amp;nbsp;itinerary_cab_2_s &amp;nbsp;... &amp;nbsp;itinerary_cab_19_s &amp;nbsp;itinerary_cab_20_s; &amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Something like the following datastep can help you generate the variable list:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;* Write list of variables to the log;&lt;BR /&gt;data _null;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; name_list length 1024;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; name_list = '';&lt;BR /&gt;&amp;nbsp; &amp;nbsp; do i=1 to 20;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;name=cats('itinerary_cab_', put(i,2.), '_s');&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;name_list = catx(' ', name_list, name);&lt;BR /&gt;&amp;nbsp; &amp;nbsp; end;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; put '(' name_list ')';&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;I don't have SAS installed on my tablet, so the above code has not been tested. &amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 27 Apr 2016 02:02:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/array-and-trim/m-p/266598#M52580</guid>
      <dc:creator>Pamela_JSRCC</dc:creator>
      <dc:date>2016-04-27T02:02:02Z</dc:date>
    </item>
    <item>
      <title>Re: array and trim</title>
      <link>https://communities.sas.com/t5/SAS-Programming/array-and-trim/m-p/266599#M52581</link>
      <description>&lt;P&gt;You should post your code.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Arrays in SAS are only a way to reference variables. They have no meaning otherwise, similar to other languages.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 27 Apr 2016 02:04:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/array-and-trim/m-p/266599#M52581</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-04-27T02:04:57Z</dc:date>
    </item>
    <item>
      <title>Re: array and trim</title>
      <link>https://communities.sas.com/t5/SAS-Programming/array-and-trim/m-p/266601#M52583</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13994"&gt;@Pamela_JSRCC﻿&lt;/a&gt;&amp;nbsp;thanks . will give it a try.&lt;/P&gt;</description>
      <pubDate>Wed, 27 Apr 2016 02:06:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/array-and-trim/m-p/266601#M52583</guid>
      <dc:creator>archibald</dc:creator>
      <dc:date>2016-04-27T02:06:29Z</dc:date>
    </item>
    <item>
      <title>Re: array and trim</title>
      <link>https://communities.sas.com/t5/SAS-Programming/array-and-trim/m-p/266602#M52584</link>
      <description>&lt;P&gt;Your variable names don't allow for some shortcuts but you can definitely use them in an array, as long as they are all numeric or all character. Use&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;array iti {20}&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;itinerary_cab_1_sc &amp;nbsp; itinerary_cab_2_sc&amp;nbsp;itinerary_cab_3_sc &amp;nbsp; itinerary_cab_4_sc&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;itinerary_cab_5_sc &amp;nbsp; itinerary_cab_6_sc&amp;nbsp;itinerary_cab_7_sc &amp;nbsp; itinerary_cab_8_sc&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;itinerary_cab_9_sc &amp;nbsp; itinerary_cab_10_sc&amp;nbsp;itinerary_cab_11_sc &amp;nbsp; itinerary_cab_12_sc&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;itinerary_cab_13_sc &amp;nbsp; itinerary_cab_14_sc&amp;nbsp;itinerary_cab_15_sc &amp;nbsp; itinerary_cab_16_sc&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;itinerary_cab_17_sc &amp;nbsp; itinerary_cab_18_sc&amp;nbsp;itinerary_cab_19_sc &amp;nbsp; itinerary_cab_20_sc;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;and saying&lt;STRONG&gt; iti{5} &lt;/STRONG&gt;will be the same as saying&lt;STRONG&gt;&amp;nbsp;itinerary_cab_5_sc&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 27 Apr 2016 02:09:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/array-and-trim/m-p/266602#M52584</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2016-04-27T02:09:16Z</dc:date>
    </item>
    <item>
      <title>Re: array and trim</title>
      <link>https://communities.sas.com/t5/SAS-Programming/array-and-trim/m-p/266603#M52585</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/462"&gt;@PGStats﻿&lt;/a&gt;&amp;nbsp;this another way of dealing with this issue. thanks&lt;/P&gt;</description>
      <pubDate>Wed, 27 Apr 2016 02:11:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/array-and-trim/m-p/266603#M52585</guid>
      <dc:creator>archibald</dc:creator>
      <dc:date>2016-04-27T02:11:16Z</dc:date>
    </item>
    <item>
      <title>Re: array and trim</title>
      <link>https://communities.sas.com/t5/SAS-Programming/array-and-trim/m-p/266608#M52589</link>
      <description>&lt;P&gt;here you go&amp;nbsp;&lt;/P&gt;&lt;P&gt;array cab_array{&lt;STRONG&gt;20&lt;/STRONG&gt;} cab_1 - cab_20;&lt;/P&gt;&lt;P&gt;array tax_array{&lt;STRONG&gt;20&lt;/STRONG&gt;} taxcode1- taxcode20;&lt;/P&gt;&lt;P&gt;do i=&lt;STRONG&gt;1&lt;/STRONG&gt; to &lt;STRONG&gt;20&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;taxcode {i}= substr(cab_array{i},&lt;STRONG&gt;1&lt;/STRONG&gt;,&lt;STRONG&gt;5&lt;/STRONG&gt;);&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;</description>
      <pubDate>Wed, 27 Apr 2016 02:42:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/array-and-trim/m-p/266608#M52589</guid>
      <dc:creator>archibald</dc:creator>
      <dc:date>2016-04-27T02:42:13Z</dc:date>
    </item>
    <item>
      <title>Re: array and trim</title>
      <link>https://communities.sas.com/t5/SAS-Programming/array-and-trim/m-p/266610#M52590</link>
      <description>&lt;P&gt;You could probably use :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;array cab_array{&lt;/SPAN&gt;&lt;STRONG&gt;20&lt;/STRONG&gt;&lt;SPAN&gt;} &lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;SPAN&gt;&lt;STRONG&gt;itinerary_cab_1_sc --&amp;nbsp;&amp;nbsp;&lt;SPAN&gt;&lt;STRONG&gt;itinerary_cab_20_sc&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Note the two dashes. The shortcut means &lt;EM&gt;all the variables in the list from&lt;/EM&gt;&amp;nbsp;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;SPAN&gt;&lt;STRONG&gt;itinerary_cab_1_sc &lt;/STRONG&gt;&lt;EM&gt;to&lt;/EM&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&lt;SPAN&gt;&lt;STRONG&gt;itinerary_cab_20_sc.&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 27 Apr 2016 02:47:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/array-and-trim/m-p/266610#M52590</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2016-04-27T02:47:22Z</dc:date>
    </item>
  </channel>
</rss>

