<?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: need help with INDEX function in ODS and Base Reporting</title>
    <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/need-help-with-INDEX-function/m-p/2067#M913</link>
    <description>You problems seems to lie in unwanted spaces that the INDEXC functions takes into account.&lt;BR /&gt;
Adding COMPRESS functions should resolve your problem and return to normal.&lt;BR /&gt;
&lt;BR /&gt;
data elem;&lt;BR /&gt;
	INPUT SID $ prgoffered $ grade $ ;&lt;BR /&gt;
	servedgr=indexc(COMPRESS(prgoffered),COMPRESS(grade));&lt;BR /&gt;
CARDS ;&lt;BR /&gt;
21185582 7 2 &lt;BR /&gt;
21609676 78 7 &lt;BR /&gt;
34645086 78 8 &lt;BR /&gt;
35962794 7 8 &lt;BR /&gt;
36489197 7 8  &lt;BR /&gt;
36784385 78 8  &lt;BR /&gt;
36982055 78 8  &lt;BR /&gt;
37097179 78 8  &lt;BR /&gt;
37220566 78 8  &lt;BR /&gt;
37228346 7 8 &lt;BR /&gt;
37241067 7 8  &lt;BR /&gt;
37398721 7 8  &lt;BR /&gt;
;&lt;BR /&gt;
run;</description>
    <pubDate>Wed, 17 Jan 2007 10:57:07 GMT</pubDate>
    <dc:creator>Olivier</dc:creator>
    <dc:date>2007-01-17T10:57:07Z</dc:date>
    <item>
      <title>need help with INDEX function</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/need-help-with-INDEX-function/m-p/2064#M910</link>
      <description>I don't understand why the INDEX function does not work the way it is supposed to. My string that is being searched is a list of grades a given program is offered to (prgoffered) such as "789" or "7" etc. (I have it saved as a character var). And then for each observation I am checking if a given student is in a grade that offers the program. Again, it is saved as a character var. My code is as follows: servedgr=indexc(prgoffered,grade); but when I print the output I see that index put a servedgr=2 when my prgoffered="7" and grade="2". Why isn't my servedgr=0 ????</description>
      <pubDate>Wed, 10 Jan 2007 21:15:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/need-help-with-INDEX-function/m-p/2064#M910</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2007-01-10T21:15:52Z</dc:date>
    </item>
    <item>
      <title>Re: need help with INDEX function</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/need-help-with-INDEX-function/m-p/2065#M911</link>
      <description>Hi,&lt;BR /&gt;
&lt;BR /&gt;
What is the code you're using? It's a little unclear from your question.&lt;BR /&gt;
&lt;BR /&gt;
I've just run this code:&lt;BR /&gt;
&lt;BR /&gt;
DATA test;&lt;BR /&gt;
    prgoffered="789";&lt;BR /&gt;
    grade="2";&lt;BR /&gt;
    servedgr=indexc(prgoffered,grade); &lt;BR /&gt;
RUN;&lt;BR /&gt;
&lt;BR /&gt;
And SERVEDGR=0 (as you would expect).&lt;BR /&gt;
&lt;BR /&gt;
Is this what you were trying?&lt;BR /&gt;
&lt;BR /&gt;
Cheers,&lt;BR /&gt;
Lawrence</description>
      <pubDate>Fri, 12 Jan 2007 15:06:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/need-help-with-INDEX-function/m-p/2065#M911</guid>
      <dc:creator>LawrenceHW</dc:creator>
      <dc:date>2007-01-12T15:06:57Z</dc:date>
    </item>
    <item>
      <title>Re: need help with INDEX function</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/need-help-with-INDEX-function/m-p/2066#M912</link>
      <description>Hi Lawrence,&lt;BR /&gt;
Thanks for your response. Indeed, when I ran the code as you said it does work but when I ran my code for some reason it does not! I am not sure why!&lt;BR /&gt;
here is my code:&lt;BR /&gt;
&lt;BR /&gt;
data elem;&lt;BR /&gt;
 set elem; /*briging the data set with student id's and   grades */&lt;BR /&gt;
&lt;BR /&gt;
  servedgr=indexc(prgoffered,grade);&lt;BR /&gt;
&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
 here is the output I get:&lt;BR /&gt;
&lt;BR /&gt;
SID      prgoffered    grade      servedgr&lt;BR /&gt;
&lt;BR /&gt;
21185582     7  2           2   &lt;BR /&gt;
21609676     78            7           1   &lt;BR /&gt;
34645086     78            8           2   &lt;BR /&gt;
35962794     7             8           2   &lt;BR /&gt;
36489197     7             8           2   &lt;BR /&gt;
36784385     78            8           2   &lt;BR /&gt;
36982055     78            8           2   &lt;BR /&gt;
37097179     78            8           2   &lt;BR /&gt;
37220566     78            8           2   &lt;BR /&gt;
37228346     7             8           2   &lt;BR /&gt;
37241067     7             8           2   &lt;BR /&gt;
37398721     7             8           2</description>
      <pubDate>Tue, 16 Jan 2007 20:12:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/need-help-with-INDEX-function/m-p/2066#M912</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2007-01-16T20:12:42Z</dc:date>
    </item>
    <item>
      <title>Re: need help with INDEX function</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/need-help-with-INDEX-function/m-p/2067#M913</link>
      <description>You problems seems to lie in unwanted spaces that the INDEXC functions takes into account.&lt;BR /&gt;
Adding COMPRESS functions should resolve your problem and return to normal.&lt;BR /&gt;
&lt;BR /&gt;
data elem;&lt;BR /&gt;
	INPUT SID $ prgoffered $ grade $ ;&lt;BR /&gt;
	servedgr=indexc(COMPRESS(prgoffered),COMPRESS(grade));&lt;BR /&gt;
CARDS ;&lt;BR /&gt;
21185582 7 2 &lt;BR /&gt;
21609676 78 7 &lt;BR /&gt;
34645086 78 8 &lt;BR /&gt;
35962794 7 8 &lt;BR /&gt;
36489197 7 8  &lt;BR /&gt;
36784385 78 8  &lt;BR /&gt;
36982055 78 8  &lt;BR /&gt;
37097179 78 8  &lt;BR /&gt;
37220566 78 8  &lt;BR /&gt;
37228346 7 8 &lt;BR /&gt;
37241067 7 8  &lt;BR /&gt;
37398721 7 8  &lt;BR /&gt;
;&lt;BR /&gt;
run;</description>
      <pubDate>Wed, 17 Jan 2007 10:57:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/need-help-with-INDEX-function/m-p/2067#M913</guid>
      <dc:creator>Olivier</dc:creator>
      <dc:date>2007-01-17T10:57:07Z</dc:date>
    </item>
    <item>
      <title>Re: need help with INDEX function</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/need-help-with-INDEX-function/m-p/2068#M914</link>
      <description>O my gosh!! That was it!! Thank you so much Olivier.&lt;BR /&gt;
&lt;BR /&gt;
Ilona</description>
      <pubDate>Thu, 18 Jan 2007 16:53:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/need-help-with-INDEX-function/m-p/2068#M914</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2007-01-18T16:53:36Z</dc:date>
    </item>
  </channel>
</rss>

