<?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: The SUBSTR function call has too many arguments in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/The-SUBSTR-function-call-has-too-many-arguments/m-p/254592#M48580</link>
    <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/4954"&gt;@Astounding﻿&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;lt;You will have to devise a set of 3 names for each incoming variable. &amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That is what I was trying to do w/ VAR1, VAR2, VAR3 for&amp;nbsp;_400203 and then&amp;nbsp;VAR4, VAR5, VAR6 for&amp;nbsp;_400204.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is there a better approach?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for the help!&lt;/P&gt;</description>
    <pubDate>Fri, 04 Mar 2016 20:06:34 GMT</pubDate>
    <dc:creator>_maldini_</dc:creator>
    <dc:date>2016-03-04T20:06:34Z</dc:date>
    <item>
      <title>The SUBSTR function call has too many arguments</title>
      <link>https://communities.sas.com/t5/SAS-Programming/The-SUBSTR-function-call-has-too-many-arguments/m-p/254575#M48574</link>
      <description>&lt;P&gt;I am trying to use the SUBSTR function to parse out values in a string.&amp;nbsp;There are 44 variables in my dataset that contain such&amp;nbsp;strings. The strings are&amp;nbsp;a maximum of 6 characters. Each value is 2 characters long. In other words, a value of 010101 has 3 distinct values (01, 01, 01).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have this:&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;_400203&lt;/U&gt; &lt;/STRONG&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;STRONG&gt;_&lt;U&gt;400204&lt;/U&gt; &lt;/STRONG&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;etc.&lt;/P&gt;
&lt;P&gt;010001 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;000100&lt;/P&gt;
&lt;P&gt;000001 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0100&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I want this:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;VAR1 &amp;nbsp;&amp;nbsp;VAR2 &amp;nbsp; &amp;nbsp;VAR3 &amp;nbsp;VAR4 &amp;nbsp;&amp;nbsp;VAR5 &amp;nbsp;&amp;nbsp;VAR6 &amp;nbsp; VAR7&amp;nbsp; &amp;nbsp; VAR8&amp;nbsp;&amp;nbsp;VAR9&amp;nbsp;&amp;nbsp; VAR10&amp;nbsp;&amp;nbsp;VAR11&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;01 &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;00 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;01 &amp;nbsp; &amp;nbsp;&amp;nbsp;00 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;00 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;01 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;00 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 01 &amp;nbsp; &amp;nbsp; &amp;nbsp; 00 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;01 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 00&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Ultimately, I want to create 3 new variables for each string:&lt;/P&gt;
&lt;P&gt;IF VAR1="01" THEN NEW_VAR1=1; ELSE NEW_VAR1=0; &lt;BR /&gt;IF VAR2="01" THEN NEW_VAR2=1; ELSE NEW_VAR2=0; &lt;BR /&gt;IF VAR3="01" THEN NEW_VAR3=1; ELSE NEW_VAR3=0;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I can run the code successfully for 1 variable, but not for more than one. I receive the following error: "The SUBSTR function call has too many arguments".&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am no expert in arrays, or in SAS in general...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is the code I'm using just to run a test using 2 variables (6 total values):&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;DATA want;
    SET have&lt;BR /&gt;
ARRAY array_name (*) $ 2 VAR1-VAR6;
DO i = 1 to 5 by 2;
array_name(i) = substr(_400203-_400204, i, 2);
END; &lt;BR /&gt;
DROP 
_400203
_400204
i;
RUN;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This code works fine for one variable:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;DATA want;
   SET have;

ARRAY array_name (*) $ 2 VAR1-VAR3;
DO i = 1 to 5 by 2;
array_name(i) = substr(_400203, i, 2);
END;

DROP 
_400203
i;
RUN; 

&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 04 Mar 2016 22:14:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/The-SUBSTR-function-call-has-too-many-arguments/m-p/254575#M48574</guid>
      <dc:creator>_maldini_</dc:creator>
      <dc:date>2016-03-04T22:14:43Z</dc:date>
    </item>
    <item>
      <title>Re: The SUBSTR function call has too many arguments</title>
      <link>https://communities.sas.com/t5/SAS-Programming/The-SUBSTR-function-call-has-too-many-arguments/m-p/254584#M48576</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/36911"&gt;@_maldini_﻿&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Have you checked the &lt;A href="http://support.sas.com/documentation/cdl/en/syntaxidx/68719/HTML/default/index.htm#/documentation/cdl/en/lefunctionsref/67960/HTML/default/n0n08xougp40i5n1xw7njpcy0a2b.htm" target="_blank"&gt;documentation of the SUBSTR function&lt;/A&gt;? The first argument to the function "&lt;SPAN&gt;specifies a character constant, variable, or expression." So, there's no room for a variable list, unfortunately.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Also, an array named &lt;FONT face="courier new,courier"&gt;array_name&lt;/FONT&gt; cannot be referenced later by a different name such as &lt;FONT face="courier new,courier"&gt;answers&lt;/FONT&gt;.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;I'm skeptical already about your code for one variable: If _400203='123456', VAR1 - VAR3 will receive the values '12', '23', '34', respectively, and not '12', '34', '56', as you might have intended. You may want to adapt the DO statement as follows:&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;do i=1 to 5 by 2;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 04 Mar 2016 19:45:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/The-SUBSTR-function-call-has-too-many-arguments/m-p/254584#M48576</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2016-03-04T19:45:20Z</dc:date>
    </item>
    <item>
      <title>Re: The SUBSTR function call has too many arguments</title>
      <link>https://communities.sas.com/t5/SAS-Programming/The-SUBSTR-function-call-has-too-many-arguments/m-p/254587#M48578</link>
      <description>&lt;P&gt;First, a quick tip. &amp;nbsp;If you have defined VAR1 as $2, you don't need the SUBSTR function. &amp;nbsp;You could code:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;var1 = _400203;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The big problem you have ias that you haven't created nearly enough variables. &amp;nbsp;If VAR1 is to hold the first two characters of _400203, you can't reuse it to hold the first two characters of some other variables at the same time. &amp;nbsp;You will have to devise a set of 3 names for each incoming variable. &amp;nbsp;Once you have that approach in mind, arrays will be the key tool that processes many variables in exactly the same way.&lt;/P&gt;</description>
      <pubDate>Fri, 04 Mar 2016 19:51:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/The-SUBSTR-function-call-has-too-many-arguments/m-p/254587#M48578</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2016-03-04T19:51:26Z</dc:date>
    </item>
    <item>
      <title>Re: The SUBSTR function call has too many arguments</title>
      <link>https://communities.sas.com/t5/SAS-Programming/The-SUBSTR-function-call-has-too-many-arguments/m-p/254591#M48579</link>
      <description>&lt;P&gt;Sorry &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/32733"&gt;@FreelanceReinh﻿&lt;/a&gt; My mistake on the array name. I corrected it in the original post.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;lt;do i=1 to 5 by 2;&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What does the 5 represent here? Should it be 6 since there are 6 digits/characters in your example?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks very much for your help.&lt;/P&gt;</description>
      <pubDate>Fri, 04 Mar 2016 20:02:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/The-SUBSTR-function-call-has-too-many-arguments/m-p/254591#M48579</guid>
      <dc:creator>_maldini_</dc:creator>
      <dc:date>2016-03-04T20:02:31Z</dc:date>
    </item>
    <item>
      <title>Re: The SUBSTR function call has too many arguments</title>
      <link>https://communities.sas.com/t5/SAS-Programming/The-SUBSTR-function-call-has-too-many-arguments/m-p/254592#M48580</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/4954"&gt;@Astounding﻿&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;lt;You will have to devise a set of 3 names for each incoming variable. &amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That is what I was trying to do w/ VAR1, VAR2, VAR3 for&amp;nbsp;_400203 and then&amp;nbsp;VAR4, VAR5, VAR6 for&amp;nbsp;_400204.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is there a better approach?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for the help!&lt;/P&gt;</description>
      <pubDate>Fri, 04 Mar 2016 20:06:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/The-SUBSTR-function-call-has-too-many-arguments/m-p/254592#M48580</guid>
      <dc:creator>_maldini_</dc:creator>
      <dc:date>2016-03-04T20:06:34Z</dc:date>
    </item>
    <item>
      <title>Re: The SUBSTR function call has too many arguments</title>
      <link>https://communities.sas.com/t5/SAS-Programming/The-SUBSTR-function-call-has-too-many-arguments/m-p/254595#M48581</link>
      <description>&lt;P&gt;My suggestion with&amp;nbsp;the DO statement focused on the SUBSTR function, whose second argument&amp;nbsp;specifies the&amp;nbsp;&lt;SPAN&gt;beginning character position of the substrings to be extracted. So, if you want to extract '12', '34' and '56' from the string '123456', those beginning character positions should be 1, 3 and 5. These are the values of the index variable of a DO loop from 1 to 5 with a step size of 2.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;However, to assign these three substrings to array elements answers(1), answers(2), answers(3), the index of the array elements must be specified&amp;nbsp;as follows:&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;answers((i+1)/2) = substr(_400203, i, 2);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 04 Mar 2016 20:13:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/The-SUBSTR-function-call-has-too-many-arguments/m-p/254595#M48581</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2016-03-04T20:13:56Z</dc:date>
    </item>
    <item>
      <title>Re: The SUBSTR function call has too many arguments</title>
      <link>https://communities.sas.com/t5/SAS-Programming/The-SUBSTR-function-call-has-too-many-arguments/m-p/254599#M48583</link>
      <description>&lt;P&gt;Can you post a sample of what your data looks like and what you want the output to look like?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Several different cases would be ideal.&lt;/P&gt;</description>
      <pubDate>Fri, 04 Mar 2016 20:25:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/The-SUBSTR-function-call-has-too-many-arguments/m-p/254599#M48583</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-03-04T20:25:43Z</dc:date>
    </item>
    <item>
      <title>Re: The SUBSTR function call has too many arguments</title>
      <link>https://communities.sas.com/t5/SAS-Programming/The-SUBSTR-function-call-has-too-many-arguments/m-p/254613#M48588</link>
      <description>&lt;P&gt;As a brief aside, this code&lt;/P&gt;
&lt;P&gt;IF VAR1=01 THEN NEW_VAR1=1; ELSE NEW_VAR1=0;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;since mentioning substr probably was intended to be&lt;/P&gt;
&lt;P&gt;IF VAR1='01' THEN NEW_VAR1=1; ELSE NEW_VAR1=0;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can get equivalent behavior with&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;New_Var1 = (Var1 = '01');&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Since SAS assigns a numeric value of 1 to a true comparison and 0 to a false comparison.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 07 Mar 2016 21:44:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/The-SUBSTR-function-call-has-too-many-arguments/m-p/254613#M48588</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-03-07T21:44:37Z</dc:date>
    </item>
    <item>
      <title>Re: The SUBSTR function call has too many arguments</title>
      <link>https://communities.sas.com/t5/SAS-Programming/The-SUBSTR-function-call-has-too-many-arguments/m-p/254615#M48589</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza﻿&lt;/a&gt;&amp;nbsp;Added to original post. Thanks!&lt;/P&gt;</description>
      <pubDate>Fri, 04 Mar 2016 20:59:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/The-SUBSTR-function-call-has-too-many-arguments/m-p/254615#M48589</guid>
      <dc:creator>_maldini_</dc:creator>
      <dc:date>2016-03-04T20:59:10Z</dc:date>
    </item>
    <item>
      <title>Re: The SUBSTR function call has too many arguments</title>
      <link>https://communities.sas.com/t5/SAS-Programming/The-SUBSTR-function-call-has-too-many-arguments/m-p/254618#M48591</link>
      <description>&lt;P&gt;Are you expecting each of those var on their own line? Or all on one line?&lt;/P&gt;</description>
      <pubDate>Fri, 04 Mar 2016 21:10:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/The-SUBSTR-function-call-has-too-many-arguments/m-p/254618#M48591</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-03-04T21:10:07Z</dc:date>
    </item>
    <item>
      <title>Re: The SUBSTR function call has too many arguments</title>
      <link>https://communities.sas.com/t5/SAS-Programming/The-SUBSTR-function-call-has-too-many-arguments/m-p/254631#M48594</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza﻿&lt;/a&gt;&amp;nbsp;I'm not sure I understand your question. Could you please clarify?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 04 Mar 2016 22:05:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/The-SUBSTR-function-call-has-too-many-arguments/m-p/254631#M48594</guid>
      <dc:creator>_maldini_</dc:creator>
      <dc:date>2016-03-04T22:05:28Z</dc:date>
    </item>
    <item>
      <title>Re: The SUBSTR function call has too many arguments</title>
      <link>https://communities.sas.com/t5/SAS-Programming/The-SUBSTR-function-call-has-too-many-arguments/m-p/254633#M48596</link>
      <description>&lt;P&gt;Would the output be a single row with 11 different variables&lt;/P&gt;
&lt;P&gt;or multiple rows with 2 variables?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You've listed your output as Var01-Var11, but structured them as rows...&lt;/P&gt;</description>
      <pubDate>Fri, 04 Mar 2016 22:09:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/The-SUBSTR-function-call-has-too-many-arguments/m-p/254633#M48596</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-03-04T22:09:20Z</dc:date>
    </item>
    <item>
      <title>Re: The SUBSTR function call has too many arguments</title>
      <link>https://communities.sas.com/t5/SAS-Programming/The-SUBSTR-function-call-has-too-many-arguments/m-p/254634#M48597</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza﻿&lt;/a&gt;&amp;nbsp;Sorry. Yes, a single row with 11 different variables.&lt;/P&gt;</description>
      <pubDate>Fri, 04 Mar 2016 22:11:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/The-SUBSTR-function-call-has-too-many-arguments/m-p/254634#M48597</guid>
      <dc:creator>_maldini_</dc:creator>
      <dc:date>2016-03-04T22:11:25Z</dc:date>
    </item>
    <item>
      <title>Re: The SUBSTR function call has too many arguments</title>
      <link>https://communities.sas.com/t5/SAS-Programming/The-SUBSTR-function-call-has-too-many-arguments/m-p/254676#M48602</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input _400203 $    _400204 $;
cards;
010001                    000100
000001                    0100
;
run;
data temp;
 set have;
 array x{*} $ _: ;
 do group=1 to dim(x);
  do i=1 to length(x{group}) by 2;
   temp=substr(x{group},i,2);output;
  end;
 end;
 keep group temp;
run;
proc sort data=temp; by group;run;
proc transpose data=temp out=want(drop=_:) prefix=var;
 var temp;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 05 Mar 2016 03:38:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/The-SUBSTR-function-call-has-too-many-arguments/m-p/254676#M48602</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2016-03-05T03:38:35Z</dc:date>
    </item>
    <item>
      <title>Re: The SUBSTR function call has too many arguments</title>
      <link>https://communities.sas.com/t5/SAS-Programming/The-SUBSTR-function-call-has-too-many-arguments/m-p/254714#M48611</link>
      <description>&lt;P&gt;I'd change the names to make them manageable later. &amp;nbsp;Arrays is still a viable option:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;data want;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;set have;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;array original {44} &amp;nbsp;_400203 _400204 ....;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;array new {44,3} $ 2 _400203_part1 - _400203_part3&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;_400204_part1 - _400204_part3&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ...;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;do i=1 to 44;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp;do j=1 to 3;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; new{i,j} = substr(original{i}, 2*j-1);&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; &amp;nbsp;end;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;end;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;run;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It's still not clear if you want to copy two characters from the original variable, or if you want to set flags based on what you find there. &amp;nbsp;But there are (as usual) plenty of ways to do it in SAS.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Technically, the SUBSTR function with no third parameter copies all remaining characters. &amp;nbsp;But since the new variables are only two characters long, the program saves just two characters in each.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Good luck.&lt;/P&gt;</description>
      <pubDate>Sat, 05 Mar 2016 14:01:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/The-SUBSTR-function-call-has-too-many-arguments/m-p/254714#M48611</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2016-03-05T14:01:09Z</dc:date>
    </item>
    <item>
      <title>Re: The SUBSTR function call has too many arguments</title>
      <link>https://communities.sas.com/t5/SAS-Programming/The-SUBSTR-function-call-has-too-many-arguments/m-p/254968#M48673</link>
      <description>&lt;P&gt;&amp;lt;It's still not clear if you want to copy two characters from the original variable,&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I want to copy 2 characters from the original variable.&lt;/P&gt;</description>
      <pubDate>Mon, 07 Mar 2016 15:32:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/The-SUBSTR-function-call-has-too-many-arguments/m-p/254968#M48673</guid>
      <dc:creator>_maldini_</dc:creator>
      <dc:date>2016-03-07T15:32:30Z</dc:date>
    </item>
    <item>
      <title>Re: The SUBSTR function call has too many arguments</title>
      <link>https://communities.sas.com/t5/SAS-Programming/The-SUBSTR-function-call-has-too-many-arguments/m-p/254972#M48676</link>
      <description>&lt;P&gt;Great.&amp;nbsp; Then I'll stick with the solution that I posted ... no changes required.&lt;/P&gt;</description>
      <pubDate>Mon, 07 Mar 2016 16:10:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/The-SUBSTR-function-call-has-too-many-arguments/m-p/254972#M48676</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2016-03-07T16:10:40Z</dc:date>
    </item>
    <item>
      <title>Re: The SUBSTR function call has too many arguments</title>
      <link>https://communities.sas.com/t5/SAS-Programming/The-SUBSTR-function-call-has-too-many-arguments/m-p/255030#M48697</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/4954"&gt;@Astounding﻿&lt;/a&gt;&amp;nbsp;This code is producing the desired result, but I'm getting a warning message: "NOTE: Invalid second argument to function SUBSTR at line 180 column 18."&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What am I doing wrong here?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;180 new{i,j} = substr(original{i}, 2*j-1);&lt;BR /&gt;181 end;&lt;BR /&gt;182 end;&lt;BR /&gt;183 run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There are 57 variables, not 44 as previously mentioned.&lt;/P&gt;
&lt;PRE&gt;DATA want;
58 SET have;
59 
60 array original {57}
61 _400201
62 _400202...;

118 
119 array new {57,3} $ 2
120 _400201_part1-_400201_part3
121 _400202_part1-_400202_part3...;
177 
178 do i=1 to 57;
179 do j=1 to 3;
180 new{i,j} = substr(original{i}, 2*j-1);
181 end;
182 end;
183 run;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 07 Mar 2016 17:56:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/The-SUBSTR-function-call-has-too-many-arguments/m-p/255030#M48697</guid>
      <dc:creator>_maldini_</dc:creator>
      <dc:date>2016-03-07T17:56:16Z</dc:date>
    </item>
    <item>
      <title>Re: The SUBSTR function call has too many arguments</title>
      <link>https://communities.sas.com/t5/SAS-Programming/The-SUBSTR-function-call-has-too-many-arguments/m-p/255034#M48698</link>
      <description>&lt;P&gt;That shouldn't happen.&amp;nbsp; The only cause that comes to mind is that one of your 57 original variables is defined as having a length less than $5.&amp;nbsp; In that case, it shouldn't really be on the list with the other variables.&lt;/P&gt;</description>
      <pubDate>Mon, 07 Mar 2016 18:02:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/The-SUBSTR-function-call-has-too-many-arguments/m-p/255034#M48698</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2016-03-07T18:02:39Z</dc:date>
    </item>
    <item>
      <title>Re: The SUBSTR function call has too many arguments</title>
      <link>https://communities.sas.com/t5/SAS-Programming/The-SUBSTR-function-call-has-too-many-arguments/m-p/255057#M48703</link>
      <description>&lt;P&gt;Do you get a single error or multiple errors? If you can, post the line mentioned in the log.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 07 Mar 2016 18:59:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/The-SUBSTR-function-call-has-too-many-arguments/m-p/255057#M48703</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-03-07T18:59:37Z</dc:date>
    </item>
  </channel>
</rss>

