<?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: SAS array subscript out of range in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/SAS-array-subscript-out-of-range/m-p/775254#M31299</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/403188"&gt;@Gablz&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Yes there was and it will always get replaced&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;That's what your code is telling SAS to do. If you want a new file to be created, you need to use a file name that doesn't exist. For example:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA WB66.erwzus_1013new; 
SET WB66.erwzusneu;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 19 Oct 2021 19:42:38 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2021-10-19T19:42:38Z</dc:date>
    <item>
      <title>SAS array subscript out of range</title>
      <link>https://communities.sas.com/t5/New-SAS-User/SAS-array-subscript-out-of-range/m-p/774720#M31236</link>
      <description>&lt;P&gt;We have the following problem. We want SAS to put the same value that is inside the last beruf variable that contains info into the next one&amp;nbsp; if the control variables Übergänge and BERUFG_A_1 match. There are beruf1 to beruf 21 so 21 variables. If we use this code it says array subscript out of range.&lt;/P&gt;&lt;P&gt;LIBNAME WB66 'D:\WB66';&lt;BR /&gt;RUN;&lt;/P&gt;&lt;P&gt;DATA WB66.erwzus_1013; SET WB66.erwzus_1013;&lt;/P&gt;&lt;P&gt;array beruf (1:21) $ beruf1-character-beruf21;&lt;/P&gt;&lt;P&gt;do i = 1 to dim(beruf);&lt;BR /&gt;if Übergänge = 2 and BERUFG_A_1=1 and i = index then beruf{i} = beruf{i-1};&lt;BR /&gt;end;&lt;/P&gt;&lt;P&gt;RUN;&lt;/P&gt;</description>
      <pubDate>Sun, 17 Oct 2021 12:46:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/SAS-array-subscript-out-of-range/m-p/774720#M31236</guid>
      <dc:creator>Gablz</dc:creator>
      <dc:date>2021-10-17T12:46:53Z</dc:date>
    </item>
    <item>
      <title>Re: SAS array subscript out of range</title>
      <link>https://communities.sas.com/t5/New-SAS-User/SAS-array-subscript-out-of-range/m-p/774731#M31241</link>
      <description>&lt;P&gt;The messages in the log should show the value of I used when the error happened.&lt;/P&gt;
&lt;P&gt;It should be happening when I=1 since you have&amp;nbsp;&lt;SPAN&gt;beruf{i-1} in your code.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Change your DO loop starting from 1 to 2 if you want to do that.&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;do i = 2 to dim(beruf);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 17 Oct 2021 15:00:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/SAS-array-subscript-out-of-range/m-p/774731#M31241</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-10-17T15:00:22Z</dc:date>
    </item>
    <item>
      <title>Re: SAS array subscript out of range</title>
      <link>https://communities.sas.com/t5/New-SAS-User/SAS-array-subscript-out-of-range/m-p/774796#M31263</link>
      <description>&lt;P&gt;Please post the complete log using "insert code", also note that "DATA WB66.erwzus_1013; SET WB66.erwzus_1013;" is always a very bad idea, if something went wrong in the step, you have to re-create WB66.erwzus_1013.&lt;/P&gt;</description>
      <pubDate>Mon, 18 Oct 2021 05:27:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/SAS-array-subscript-out-of-range/m-p/774796#M31263</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2021-10-18T05:27:14Z</dc:date>
    </item>
    <item>
      <title>Re: SAS array subscript out of range</title>
      <link>https://communities.sas.com/t5/New-SAS-User/SAS-array-subscript-out-of-range/m-p/774863#M31269</link>
      <description>&lt;P&gt;Thank you! It works now &lt;span class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;😄&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 18 Oct 2021 11:52:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/SAS-array-subscript-out-of-range/m-p/774863#M31269</guid>
      <dc:creator>Gablz</dc:creator>
      <dc:date>2021-10-18T11:52:07Z</dc:date>
    </item>
    <item>
      <title>Re: SAS array subscript out of range</title>
      <link>https://communities.sas.com/t5/New-SAS-User/SAS-array-subscript-out-of-range/m-p/775248#M31296</link>
      <description>Hey &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;Thanks for your reply. I tried DATA WB66.erwzus_1013; SET WB66.erwzusneu; but it doesnt make a new file. Do you know what i could use instead? Or do i have to create an empty file first?</description>
      <pubDate>Tue, 19 Oct 2021 19:30:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/SAS-array-subscript-out-of-range/m-p/775248#M31296</guid>
      <dc:creator>Gablz</dc:creator>
      <dc:date>2021-10-19T19:30:38Z</dc:date>
    </item>
    <item>
      <title>Re: SAS array subscript out of range</title>
      <link>https://communities.sas.com/t5/New-SAS-User/SAS-array-subscript-out-of-range/m-p/775252#M31297</link>
      <description>&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;I tried DATA WB66.erwzus_1013; SET WB66.erwzusneu;&amp;nbsp;but it doesnt make a new file.&lt;/SPAN&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;BR /&gt;Was there already a existing file named WB66.erwzus_1013??&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Oct 2021 19:41:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/SAS-array-subscript-out-of-range/m-p/775252#M31297</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-10-19T19:41:11Z</dc:date>
    </item>
    <item>
      <title>Re: SAS array subscript out of range</title>
      <link>https://communities.sas.com/t5/New-SAS-User/SAS-array-subscript-out-of-range/m-p/775253#M31298</link>
      <description>Yes there was and it will always get replaced</description>
      <pubDate>Tue, 19 Oct 2021 19:41:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/SAS-array-subscript-out-of-range/m-p/775253#M31298</guid>
      <dc:creator>Gablz</dc:creator>
      <dc:date>2021-10-19T19:41:09Z</dc:date>
    </item>
    <item>
      <title>Re: SAS array subscript out of range</title>
      <link>https://communities.sas.com/t5/New-SAS-User/SAS-array-subscript-out-of-range/m-p/775254#M31299</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/403188"&gt;@Gablz&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Yes there was and it will always get replaced&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;That's what your code is telling SAS to do. If you want a new file to be created, you need to use a file name that doesn't exist. For example:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA WB66.erwzus_1013new; 
SET WB66.erwzusneu;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 19 Oct 2021 19:42:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/SAS-array-subscript-out-of-range/m-p/775254#M31299</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-10-19T19:42:38Z</dc:date>
    </item>
    <item>
      <title>Re: SAS array subscript out of range</title>
      <link>https://communities.sas.com/t5/New-SAS-User/SAS-array-subscript-out-of-range/m-p/775256#M31300</link>
      <description>But i also want the program to use Data from an existing file so i want him to take the information out of WB66.erwzus_1013. If i do it that way SAS tells me the file doesnt exist</description>
      <pubDate>Tue, 19 Oct 2021 19:46:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/SAS-array-subscript-out-of-range/m-p/775256#M31300</guid>
      <dc:creator>Gablz</dc:creator>
      <dc:date>2021-10-19T19:46:39Z</dc:date>
    </item>
    <item>
      <title>Re: SAS array subscript out of range</title>
      <link>https://communities.sas.com/t5/New-SAS-User/SAS-array-subscript-out-of-range/m-p/775257#M31301</link>
      <description>Maybe thats a little bit confusing but there already is WB66.erwzus_1013 with information that i want to work with and i want the program to make a new file and he should put everything that i change into that file like a copy but with the changes</description>
      <pubDate>Tue, 19 Oct 2021 19:48:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/SAS-array-subscript-out-of-range/m-p/775257#M31301</guid>
      <dc:creator>Gablz</dc:creator>
      <dc:date>2021-10-19T19:48:59Z</dc:date>
    </item>
    <item>
      <title>Re: SAS array subscript out of range</title>
      <link>https://communities.sas.com/t5/New-SAS-User/SAS-array-subscript-out-of-range/m-p/775259#M31302</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/403188"&gt;@Gablz&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Maybe thats a little bit confusing but there already is WB66.erwzus_1013 with information that i want to work with and i want the program to make a new file and he should put everything that i change into that file like a copy but with the changes&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;The names of dataset(s) listed in the DATA statement are the target names.&amp;nbsp; The names of dataset(s) listed in the SET statement are the source datasets.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The comment that triggered the discussion was that you should be very careful about using the same name in both places because if there is a problem then your source dataset might be lost.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Instead get in the habit of making a new dataset to and only read from the original dataset.&amp;nbsp; The new dataset will have all of the data from the old datasets with any changes made to it in this data step.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data new;
  set old;
  *** more statements that manipulate the data ** ;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 19 Oct 2021 19:57:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/SAS-array-subscript-out-of-range/m-p/775259#M31302</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-10-19T19:57:25Z</dc:date>
    </item>
    <item>
      <title>Re: SAS array subscript out of range</title>
      <link>https://communities.sas.com/t5/New-SAS-User/SAS-array-subscript-out-of-range/m-p/775261#M31303</link>
      <description>Oh okay i thought there was a command for that thank you &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;</description>
      <pubDate>Tue, 19 Oct 2021 19:59:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/SAS-array-subscript-out-of-range/m-p/775261#M31303</guid>
      <dc:creator>Gablz</dc:creator>
      <dc:date>2021-10-19T19:59:01Z</dc:date>
    </item>
    <item>
      <title>Re: SAS array subscript out of range</title>
      <link>https://communities.sas.com/t5/New-SAS-User/SAS-array-subscript-out-of-range/m-p/775264#M31304</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/403188"&gt;@Gablz&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;But i also want the program to use Data from an existing file so i want him to take the information out of WB66.erwzus_1013. If i do it that way SAS tells me the file doesnt exist&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;I think this is what you want&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA WB66.erwzus_1013new; 
SET WB66.erwzus_1013;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Oct 2021 20:02:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/SAS-array-subscript-out-of-range/m-p/775264#M31304</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-10-19T20:02:05Z</dc:date>
    </item>
  </channel>
</rss>

