<?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: ERROR ##-###: The INDEX function call has too many arguments. in SAS Data Management</title>
    <link>https://communities.sas.com/t5/SAS-Data-Management/ERROR-The-INDEX-function-call-has-too-many-arguments/m-p/675053#M19470</link>
    <description>Show the code that doesn't work. Showing working code doesn't help us isolate the issue, you likely forgot a quote, comma or bracket so pay attention to exactly where the error is indicated, SAS provides the line and column number for you to find it easily.</description>
    <pubDate>Thu, 06 Aug 2020 16:16:17 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2020-08-06T16:16:17Z</dc:date>
    <item>
      <title>ERROR ##-###: The INDEX function call has too many arguments.</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/ERROR-The-INDEX-function-call-has-too-many-arguments/m-p/675045#M19469</link>
      <description>&lt;P&gt;I am working with data trying to identify opioid useage.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;set have;&lt;/P&gt;&lt;P&gt;IF INDEX(UPCASE(var1), "METHADONE")&amp;gt;0 or INDEX(UPCASE(var2), "METHADONE")&amp;gt;0 or&lt;BR /&gt;INDEX(UPCASE(var3), "METHADONE")&amp;gt;0 or INDEX(UPCASE(var4), "METHADONE")&amp;gt;0 or&lt;BR /&gt;INDEX(UPCASE(var5&lt;SPAN style="font-family: inherit;"&gt;), "METHADONE")&amp;gt;0 or INDEX(UPCASE(var6), "METHADONE")&amp;gt;0&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;THEN OPI_3=1;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This code works for 14 of the 16 substances I am looking for.&lt;/P&gt;&lt;P&gt;But when I am looking for OPANA and CODIENE it is popping up with:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ERROR ##-###: The INDEX function call has too many arguments.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I think this may be something about how the data is formatted but I haven't had to use INDEX before.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 06 Aug 2020 16:03:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/ERROR-The-INDEX-function-call-has-too-many-arguments/m-p/675045#M19469</guid>
      <dc:creator>DanielQuay</dc:creator>
      <dc:date>2020-08-06T16:03:39Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR ##-###: The INDEX function call has too many arguments.</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/ERROR-The-INDEX-function-call-has-too-many-arguments/m-p/675053#M19470</link>
      <description>Show the code that doesn't work. Showing working code doesn't help us isolate the issue, you likely forgot a quote, comma or bracket so pay attention to exactly where the error is indicated, SAS provides the line and column number for you to find it easily.</description>
      <pubDate>Thu, 06 Aug 2020 16:16:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/ERROR-The-INDEX-function-call-has-too-many-arguments/m-p/675053#M19470</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2020-08-06T16:16:17Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR ##-###: The INDEX function call has too many arguments.</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/ERROR-The-INDEX-function-call-has-too-many-arguments/m-p/675055#M19471</link>
      <description>&lt;P&gt;Show us the log for this DATA step. We need to see everything in the log, code, NOTEs, WARNINGs, and ERRORs.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You need to preserve the formatting of the log by copying it as text and pasting it into the window that appears when you click on the &amp;lt;/&amp;gt; icon. DO NOT SKIP THIS STEP!&lt;/P&gt;</description>
      <pubDate>Thu, 06 Aug 2020 16:16:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/ERROR-The-INDEX-function-call-has-too-many-arguments/m-p/675055#M19471</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-08-06T16:16:43Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR ##-###: The INDEX function call has too many arguments.</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/ERROR-The-INDEX-function-call-has-too-many-arguments/m-p/675060#M19472</link>
      <description>&lt;P&gt;IF INDEX(UPCASE(var1), "OPANA" &amp;gt;0 or INDEX(UPCASE(var2), "OPANA")&amp;gt;0 or&lt;BR /&gt;INDEX(UPCASE(var3), "OPANA")&amp;gt;0 or INDEX(UPCASE(var4), "OPANA")&amp;gt;0 or&lt;BR /&gt;INDEX(UPCASE(var5), "OPANA")&amp;gt;0 or INDEX(UPCASE(var6), "OPANA")&amp;gt;0&lt;BR /&gt;THEN OPI_6=1;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;IF INDEX(UPCASE(var1), "CODEINE" &amp;gt;0 or INDEX(UPCASE(var2), "CODEINE")&amp;gt;0 or&lt;BR /&gt;INDEX(UPCASE(var3), "CODEINE")&amp;gt;0 or INDEX(UPCASE(var4), "CODEINE")&amp;gt;0 or&lt;BR /&gt;INDEX(UPCASE(var5), "CODEINE")&amp;gt;0 or INDEX(UPCASE(var6), "CODEINE")&amp;gt;0&lt;BR /&gt;THEN OPI_16=1;&lt;/P&gt;</description>
      <pubDate>Thu, 06 Aug 2020 16:19:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/ERROR-The-INDEX-function-call-has-too-many-arguments/m-p/675060#M19472</guid>
      <dc:creator>DanielQuay</dc:creator>
      <dc:date>2020-08-06T16:19:15Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR ##-###: The INDEX function call has too many arguments.</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/ERROR-The-INDEX-function-call-has-too-many-arguments/m-p/675064#M19473</link>
      <description>&lt;P&gt;If you are going to do such code frequently I suggest that you go ahead and make the case standard, either all lower or all upper so you can eliminate multiple Upcase(SSSS) the make code more readable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And there are nicer ways to search for the same value among a bunch of variables:&lt;/P&gt;
&lt;PRE&gt;data want;
   set have;
   array v Var1-var6;
   /* assumes all of the variables have been&lt;BR /&gt;      UPCASED prior&lt;BR /&gt;   */
   opi3 = ( whichc('METHADONE', of v(*))&amp;gt;0);
run;&lt;BR /&gt;&lt;BR /&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The WHICHC, and numeric WHICHN functions return the position number that the first parameter, in this case the word METHADONE appears in a list of variables, using an array for short hand instead of listing var1, var2, var3, var4,var5, var6. If a value match is found the function will return the position in that list, i.e. 3 would mean that VAR3 matched, or zero otherwise. The surrounding ( &amp;gt;0) means the variable is&amp;nbsp; assigned a comparison true/false result which is 1/0 numeric by default with SAS.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Fewer parentheses, fewer quotes, fewer commas and fewer OR mean that you are much less likely to miss one of them.&lt;/P&gt;</description>
      <pubDate>Thu, 06 Aug 2020 16:30:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/ERROR-The-INDEX-function-call-has-too-many-arguments/m-p/675064#M19473</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-08-06T16:30:00Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR ##-###: The INDEX function call has too many arguments.</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/ERROR-The-INDEX-function-call-has-too-many-arguments/m-p/675072#M19474</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
   set have;

   array v Var1-var6;

*make this big enough to hold all values;
length str $500.;
str = upcase(catx('-', of v(*)));

   opi3 = index(str, 'METHADONE')&amp;gt;0;
   opi6 = index(str, 'OPANA')&amp;gt;0;
   opi16 = index(str, 'CODIENE')&amp;gt;0;


run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Also, if you have DINs there's drug listing DBs that you can use to link your drugs and they're categorized by categories, one of which is opioids. We're currently building out our PDMP so we're using the DB as it's constantly updated in our process.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The approach above concatenates all the values into one string, separated by a hypen (-), and searches that string. Then you need a single line of code to search that new string and create your flags. You COULD design a loop that goes over your diagnosis to make this&amp;nbsp; more efficient if you have a ton of diagnosis.&lt;/P&gt;</description>
      <pubDate>Thu, 06 Aug 2020 17:06:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/ERROR-The-INDEX-function-call-has-too-many-arguments/m-p/675072#M19474</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2020-08-06T17:06:55Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR ##-###: The INDEX function call has too many arguments.</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/ERROR-The-INDEX-function-call-has-too-many-arguments/m-p/675073#M19475</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/205036"&gt;@DanielQuay&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;IF INDEX(UPCASE(var1), "OPANA" &amp;gt;0 or INDEX(UPCASE(var2), "OPANA")&amp;gt;0 or&lt;BR /&gt;INDEX(UPCASE(var3), "OPANA")&amp;gt;0 or INDEX(UPCASE(var4), "OPANA")&amp;gt;0 or&lt;BR /&gt;INDEX(UPCASE(var5), "OPANA")&amp;gt;0 or INDEX(UPCASE(var6), "OPANA")&amp;gt;0&lt;BR /&gt;THEN OPI_6=1;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;IF INDEX(UPCASE(var1), "CODEINE" &amp;gt;0 or INDEX(UPCASE(var2), "CODEINE")&amp;gt;0 or&lt;BR /&gt;INDEX(UPCASE(var3), "CODEINE")&amp;gt;0 or INDEX(UPCASE(var4), "CODEINE")&amp;gt;0 or&lt;BR /&gt;INDEX(UPCASE(var5), "CODEINE")&amp;gt;0 or INDEX(UPCASE(var6), "CODEINE")&amp;gt;0&lt;BR /&gt;THEN OPI_16=1;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;We also need to see the LOG, as I described above.&lt;/P&gt;</description>
      <pubDate>Thu, 06 Aug 2020 17:12:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/ERROR-The-INDEX-function-call-has-too-many-arguments/m-p/675073#M19475</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-08-06T17:12:38Z</dc:date>
    </item>
  </channel>
</rss>

