<?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: Not having to type a string of variables in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Not-having-to-type-a-string-of-variables/m-p/390638#M66138</link>
    <description>&lt;P&gt;You need to declare two arrays acares and cares, OR you meant acares but typed cares.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Your list approach should work just fine if the array statement is correct.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 24 Aug 2017 14:57:48 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2017-08-24T14:57:48Z</dc:date>
    <item>
      <title>Not having to type a string of variables</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Not-having-to-type-a-string-of-variables/m-p/390636#M66137</link>
      <description>&lt;P&gt;I have this dataset with over 50 variables all starting with the same prefix (cares_sf_1, cares_sf_2, cares_sf_3, cares_sf_4 ,and so on up to 50). I am trying to do create an array that contains all these variables without having to type each one of them out. Is there a way to do this? I thought 'cares_sf_1-cares_sf_7" might work, but apparently it doesn't appear to be the right syntax and I can't find a solution through google searches.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is what I've currently done that isn't working:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;DATA CARES; SET RedcapDB;
ARRAY acares_sf_{7} cares_sf_1-cares_sf_7;
DO i = 1 to 7;
acares_sf_[i] = cares_sf_[i] - 1;
END;
RUN;&lt;/PRE&gt;&lt;P&gt;Error message:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;7120  DATA CARES; SET RedcapDB;
7121  ARRAY acares_sf_{7} cares_sf_1-cares_sf_7;
7122  DO i = 1 to 7;
7123  acares_sf_[i] = cares_sf_[i] - 1;
ERROR: Undeclared array referenced: cares_sf_.
ERROR: Variable cares_sf_ has not been declared as an array.
7124  END;
7125  RUN;&lt;/PRE&gt;&lt;P&gt;Any help is appreciated. Thank you!&lt;/P&gt;</description>
      <pubDate>Thu, 24 Aug 2017 14:54:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Not-having-to-type-a-string-of-variables/m-p/390636#M66137</guid>
      <dc:creator>lady8506</dc:creator>
      <dc:date>2017-08-24T14:54:54Z</dc:date>
    </item>
    <item>
      <title>Re: Not having to type a string of variables</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Not-having-to-type-a-string-of-variables/m-p/390638#M66138</link>
      <description>&lt;P&gt;You need to declare two arrays acares and cares, OR you meant acares but typed cares.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Your list approach should work just fine if the array statement is correct.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 24 Aug 2017 14:57:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Not-having-to-type-a-string-of-variables/m-p/390638#M66138</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-08-24T14:57:48Z</dc:date>
    </item>
    <item>
      <title>Re: Not having to type a string of variables</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Not-having-to-type-a-string-of-variables/m-p/390640#M66139</link>
      <description>Hey Ballard, I just figured out what I was doing wrong. Thanks for replying.</description>
      <pubDate>Thu, 24 Aug 2017 15:02:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Not-having-to-type-a-string-of-variables/m-p/390640#M66139</guid>
      <dc:creator>lady8506</dc:creator>
      <dc:date>2017-08-24T15:02:42Z</dc:date>
    </item>
    <item>
      <title>Re: Not having to type a string of variables</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Not-having-to-type-a-string-of-variables/m-p/390646#M66140</link>
      <description>&lt;P&gt;You're looking for something called variable lists.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Another option is the colon short cut, which includes everything with that prefix:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;array myArray(*) prefix: ;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 24 Aug 2017 15:15:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Not-having-to-type-a-string-of-variables/m-p/390646#M66140</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-08-24T15:15:47Z</dc:date>
    </item>
    <item>
      <title>Re: Not having to type a string of variables</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Not-having-to-type-a-string-of-variables/m-p/390648#M66141</link>
      <description>&lt;P&gt;Assuming you fixed the array name reference, you will also need to change the DO loop:&amp;nbsp; do i=2 to 7;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There is no 0th element to copy into the 1st element.&lt;/P&gt;</description>
      <pubDate>Thu, 24 Aug 2017 15:18:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Not-having-to-type-a-string-of-variables/m-p/390648#M66141</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2017-08-24T15:18:21Z</dc:date>
    </item>
  </channel>
</rss>

