<?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: Trying to store data in multiple arrays within a dataset in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Trying-to-store-data-in-multiple-arrays-within-a-dataset/m-p/346354#M22911</link>
    <description>&lt;P&gt;To expand a little on &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/42345"&gt;@rogerjdeangelis&lt;/a&gt;, _character_ refers to ALL character variables as a list.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So when you use _character_ on the definition of Array C it used all of the existing character variables as the start of the variable list and then added the Caps1 to Caps3. So the first three variables were lows1 to lows 3;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please see this code for a demonstration.&lt;/P&gt;
&lt;PRE&gt;data TEST ;
     array L{*} $50 _character_ lows1-lows3;
     array C{*} $50 _character_ CAPS1-CAPS3;
     length name $ 10;
     do x = 1 to dim(C);
         name = vname(C[x]);
         put x= name=;
        
     end;
run;&lt;/PRE&gt;
&lt;P&gt;The result of Dim(c) is 6 where you likely expected 3 elements in C. And since your code references x= 1 to 3 the rest is, hopefully, obvious.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 31 Mar 2017 22:48:42 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2017-03-31T22:48:42Z</dc:date>
    <item>
      <title>Trying to store data in multiple arrays within a dataset</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Trying-to-store-data-in-multiple-arrays-within-a-dataset/m-p/346351#M22909</link>
      <description>&lt;P&gt;Greetings fellow SAS programmers,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have been using arrays successfully for quite some time now, but I guess I had never really used mulitple arrays in a dataset.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is killing me. &amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For example:&amp;nbsp;I am trying to capture lower case letters in array L{}, and capital letters in array C{}.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data TEST ;&lt;BR /&gt;     array L{*} $50 _character_ lows1-lows3;&lt;BR /&gt;     array C{*} $50 _character_ CAPS1-CAPS3;&lt;BR /&gt;     lows_LIST="abc,def,ghi";&lt;BR /&gt;     CAPS_LIST="ABC,DEF,GHI";&lt;BR /&gt;     do x = 1 to 3;&lt;BR /&gt;        L[x] = scan (lows_LIST, x, ',');&lt;BR /&gt;        C[x] = scan (CAPS_LIST, x, ',');&lt;BR /&gt;     end;&lt;BR /&gt;run;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am not able to understand why C[x] is not getting stored in CAPS1,CAPS2,CAPS3 instead replacing lows1, lows2 and lows3.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/8094i14BA6AB6ECCB5297/image-size/original?v=1.0&amp;amp;px=-1" border="0" alt="sas_result.png" title="sas_result.png" /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Clearly, I am understanding this the wrong way. &amp;nbsp;I have no issue if I only want to capture in one array.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can somebody please educate me? How can I fix this problem?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you very much.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Sincerely,&lt;/P&gt;
&lt;P&gt;Naresh&lt;/P&gt;</description>
      <pubDate>Fri, 31 Mar 2017 22:07:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Trying-to-store-data-in-multiple-arrays-within-a-dataset/m-p/346351#M22909</guid>
      <dc:creator>Yeti</dc:creator>
      <dc:date>2017-03-31T22:07:46Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to store data in multiple arrays within a dataset</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Trying-to-store-data-in-multiple-arrays-within-a-dataset/m-p/346353#M22910</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Remove _character_ especially on the second array.


data TEST ;
     array L{*} $50  lows1-lows3;
     array C{*} $50  CAPS1-CAPS3;
     lows_LIST="abc,def,ghi";
     CAPS_LIST="ABC,DEF,GHI";
     do x = 1 to 3;
        L[x] = scan (lows_LIST, x, ',');
        C[x] = scan (CAPS_LIST, x, ',');
     end;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 31 Mar 2017 22:28:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Trying-to-store-data-in-multiple-arrays-within-a-dataset/m-p/346353#M22910</guid>
      <dc:creator>rogerjdeangelis</dc:creator>
      <dc:date>2017-03-31T22:28:58Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to store data in multiple arrays within a dataset</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Trying-to-store-data-in-multiple-arrays-within-a-dataset/m-p/346354#M22911</link>
      <description>&lt;P&gt;To expand a little on &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/42345"&gt;@rogerjdeangelis&lt;/a&gt;, _character_ refers to ALL character variables as a list.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So when you use _character_ on the definition of Array C it used all of the existing character variables as the start of the variable list and then added the Caps1 to Caps3. So the first three variables were lows1 to lows 3;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please see this code for a demonstration.&lt;/P&gt;
&lt;PRE&gt;data TEST ;
     array L{*} $50 _character_ lows1-lows3;
     array C{*} $50 _character_ CAPS1-CAPS3;
     length name $ 10;
     do x = 1 to dim(C);
         name = vname(C[x]);
         put x= name=;
        
     end;
run;&lt;/PRE&gt;
&lt;P&gt;The result of Dim(c) is 6 where you likely expected 3 elements in C. And since your code references x= 1 to 3 the rest is, hopefully, obvious.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 31 Mar 2017 22:48:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Trying-to-store-data-in-multiple-arrays-within-a-dataset/m-p/346354#M22911</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-03-31T22:48:42Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to store data in multiple arrays within a dataset</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Trying-to-store-data-in-multiple-arrays-within-a-dataset/m-p/346365#M22912</link>
      <description>&lt;P&gt;Thank you very much&amp;nbsp;ballardw and rogerjdeangelis.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is really interesting. &amp;nbsp;I removed the _character_ from the second array and behold the value of dim(L) = 3. &amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It is very good to find this out. &amp;nbsp;Thank you again so much.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Have a great weekend.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 01 Apr 2017 02:37:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Trying-to-store-data-in-multiple-arrays-within-a-dataset/m-p/346365#M22912</guid>
      <dc:creator>Yeti</dc:creator>
      <dc:date>2017-04-01T02:37:38Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to store data in multiple arrays within a dataset</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Trying-to-store-data-in-multiple-arrays-within-a-dataset/m-p/346385#M22913</link>
      <description>&lt;P&gt;Remove the _CHARACTER_ variable list from the first array also. The $50 is what is telling SAS that it should create the variables named in the list as character variables of length 50.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The _CHARACTER_ is a request for a list of variables, like _ALL_ or VAR1-VAR10. The only reason it is not causing trouble is because it is the first statement in the data step. &amp;nbsp;So when SAS compiles it there are NO variable yet. &amp;nbsp;But if you re-order the statements in your data step it will cause trouble. &amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 01 Apr 2017 11:37:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Trying-to-store-data-in-multiple-arrays-within-a-dataset/m-p/346385#M22913</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2017-04-01T11:37:44Z</dc:date>
    </item>
  </channel>
</rss>

