<?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: Lookup problem, with multiple categories in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Lookup-problem-with-multiple-categories/m-p/597200#M172063</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/134848"&gt;@MKS2204&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi, Request everyone to please have a look at the problem, Appreciate your help.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Just to explain to you why I'm not answering: There is just too much in your question for me to get my head around within reasonable time. You get normally more answers quicker if you break a problem apart, then try to first solve the steps yourself and ask targeted questions for where you get stuck.&lt;/P&gt;
&lt;P&gt;It's also normally a good idea to not only post sample data and desired output but to also post your code (fully working or not) and explain where you got stuck. Posting your own code also lets us better understand on what level you are so we can provide answers which you can understand.&lt;/P&gt;</description>
    <pubDate>Thu, 17 Oct 2019 08:04:43 GMT</pubDate>
    <dc:creator>Patrick</dc:creator>
    <dc:date>2019-10-17T08:04:43Z</dc:date>
    <item>
      <title>Lookup problem, with multiple categories</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Lookup-problem-with-multiple-categories/m-p/596371#M171700</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am facing a programming logic roadblock. Tried a lot of ways but not successful.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a SAS data set as below :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;TABLE&gt;
&lt;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t;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;51&lt;/TD&gt;
&lt;TD&gt;Low&lt;/TD&gt;
&lt;TD&gt;1&lt;/TD&gt;
&lt;TD&gt;50&lt;/TD&gt;
&lt;TD&gt;100&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;51&lt;/TD&gt;
&lt;TD&gt;Medium&lt;/TD&gt;
&lt;TD&gt;1&lt;/TD&gt;
&lt;TD&gt;101&lt;/TD&gt;
&lt;TD&gt;150&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;51&lt;/TD&gt;
&lt;TD&gt;High&lt;/TD&gt;
&lt;TD&gt;1&lt;/TD&gt;
&lt;TD&gt;151&lt;/TD&gt;
&lt;TD&gt;200&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;51&lt;/TD&gt;
&lt;TD&gt;Low&lt;/TD&gt;
&lt;TD&gt;2.1&lt;/TD&gt;
&lt;TD&gt;75&lt;/TD&gt;
&lt;TD&gt;125&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;51&lt;/TD&gt;
&lt;TD&gt;Medium&lt;/TD&gt;
&lt;TD&gt;2.1&lt;/TD&gt;
&lt;TD&gt;126&lt;/TD&gt;
&lt;TD&gt;175&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;51&lt;/TD&gt;
&lt;TD&gt;High&lt;/TD&gt;
&lt;TD&gt;2.1&lt;/TD&gt;
&lt;TD&gt;176&lt;/TD&gt;
&lt;TD&gt;200&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In the dataset there are 120 columns named&amp;nbsp; "score1 - score120" also Final score1-finalscore120.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Now I have to check each unique "score" ( from the excel) for the testcode&amp;nbsp; in the dataset columns Score1 - Score120 , If there is a hit, I need to take corresponding "Finalscore" column ( from 120 columns in dataset) and lookup that "Finalscore" against the excel for the same testcode and score , and find out what range of upperlimit and lowerlimit&amp;nbsp; it falls in., Once I have the hit, I need to take the "Proficiency" value from the excel and check that value in dataset "Prof_Level" column , if that value is present in that string along with the Score value in process.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Example :&lt;/P&gt;
&lt;P&gt;From excel sheet, we take Score = 1 for testcode 41 and try to find it in the dataset column&amp;nbsp; Score1-Score120 , We have "Score1" in dataset =1, so thats a hit, Now we take corresponding Final Score from dataset, in this case "Final_score1" = 74, Now we take 74 and check in excel sheet against testcode 41 and score=1 and see what range it falls in , It falls in row 1 in excel sheet, Now We take value&amp;nbsp; "Low" from there and check "PROF_Level" in dataset if it has the "Low" next to "1".&amp;nbsp; and we have Low next to "1" so&amp;nbsp; we are good, else we flag that record as error.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I know its a lot, But I am not able to get the solution to it, and I am pretty sure Its not a straight forward joins or lookup.&lt;/P&gt;
&lt;P&gt;I am trying and would have tried more myself, I have to complete something on very urgent bases.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please let me know if you need more information.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Appreciate all your help.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;
&lt;P&gt;Manoj&lt;/P&gt;</description>
      <pubDate>Tue, 15 Oct 2019 00:31:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Lookup-problem-with-multiple-categories/m-p/596371#M171700</guid>
      <dc:creator>MKS2204</dc:creator>
      <dc:date>2019-10-15T00:31:48Z</dc:date>
    </item>
    <item>
      <title>Re: A little Complex SAS Problem</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Lookup-problem-with-multiple-categories/m-p/596397#M171711</link>
      <description>&lt;P&gt;Based on above inputs, please show what you want as output, exactly. Makes sure the input and output lines up based on your sample data. If you can provide your data as a full data step you're more likely to get a response as well, rather than as embedded in an Excel file or as HTML text (it carries weird formatting when you copy/paste into SAS). &lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;Here are instructions on how to provide sample data as a data step:&lt;BR /&gt;&lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712" target="_blank"&gt;https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Good Luck.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/134848"&gt;@MKS2204&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi All,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am facing a programming logic roadblock. Tried a lot of ways but not successful.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a SAS data set as below :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;TABLE&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD&gt;Testcode&lt;/TD&gt;
&lt;TD&gt;score1&amp;nbsp;&lt;/TD&gt;
&lt;TD&gt;score2&lt;/TD&gt;
&lt;TD&gt;score120&lt;/TD&gt;
&lt;TD&gt;Final_score1&amp;nbsp;&lt;/TD&gt;
&lt;TD&gt;Final_score2&lt;/TD&gt;
&lt;TD&gt;Final_score120&lt;/TD&gt;
&lt;TD&gt;Prof_level&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;41&lt;/TD&gt;
&lt;TD&gt;1&lt;/TD&gt;
&lt;TD&gt;4.5&lt;/TD&gt;
&lt;TD&gt;2.3.4&lt;/TD&gt;
&lt;TD&gt;74&lt;/TD&gt;
&lt;TD&gt;230&lt;/TD&gt;
&lt;TD&gt;555&lt;/TD&gt;
&lt;TD&gt;1 Low 2.2 Medium&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;41&lt;/TD&gt;
&lt;TD&gt;.&lt;/TD&gt;
&lt;TD&gt;5.6&lt;/TD&gt;
&lt;TD&gt;.&lt;/TD&gt;
&lt;TD&gt;450&lt;/TD&gt;
&lt;TD&gt;130&lt;/TD&gt;
&lt;TD&gt;250&lt;/TD&gt;
&lt;TD&gt;2.2 Medium 2 High&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;51&lt;/TD&gt;
&lt;TD&gt;6.6&lt;/TD&gt;
&lt;TD&gt;2.1&lt;/TD&gt;
&lt;TD&gt;2.3.4&lt;/TD&gt;
&lt;TD&gt;450&lt;/TD&gt;
&lt;TD&gt;130&lt;/TD&gt;
&lt;TD&gt;555&lt;/TD&gt;
&lt;TD&gt;2.1 Medium 1 Low&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And i also have an excel sheet containing below data :&lt;/P&gt;
&lt;TABLE&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD&gt;Testcode&lt;/TD&gt;
&lt;TD&gt;Proficiency&lt;/TD&gt;
&lt;TD&gt;Score&lt;/TD&gt;
&lt;TD&gt;Lowerlimit&lt;/TD&gt;
&lt;TD&gt;Upperlimit&lt;/TD&gt;
&lt;/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Medium&lt;/TD&gt;
&lt;TD&gt;1&lt;/TD&gt;
&lt;TD&gt;101&lt;/TD&gt;
&lt;TD&gt;150&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;51&lt;/TD&gt;
&lt;TD&gt;High&lt;/TD&gt;
&lt;TD&gt;1&lt;/TD&gt;
&lt;TD&gt;151&lt;/TD&gt;
&lt;TD&gt;200&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;51&lt;/TD&gt;
&lt;TD&gt;Low&lt;/TD&gt;
&lt;TD&gt;2.1&lt;/TD&gt;
&lt;TD&gt;75&lt;/TD&gt;
&lt;TD&gt;125&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;51&lt;/TD&gt;
&lt;TD&gt;Medium&lt;/TD&gt;
&lt;TD&gt;2.1&lt;/TD&gt;
&lt;TD&gt;126&lt;/TD&gt;
&lt;TD&gt;175&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;51&lt;/TD&gt;
&lt;TD&gt;High&lt;/TD&gt;
&lt;TD&gt;2.1&lt;/TD&gt;
&lt;TD&gt;176&lt;/TD&gt;
&lt;TD&gt;200&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In the dataset there are 120 columns named&amp;nbsp; "score1 - score120" also Final score1-finalscore120.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Now I have to check each unique "score" ( from the excel) for the testcode&amp;nbsp; in the dataset columns Score1 - Score120 , If there is a hit, I need to take corresponding "Finalscore" column ( from 120 columns in dataset) and lookup that "Finalscore" against the excel for the same testcode and score , and find out what range of upperlimit and lowerlimit&amp;nbsp; it falls in., Once I have the hit, I need to take the "Proficiency" value from the excel and check that value in dataset "Prof_Level" column , if that value is present in that string along with the Score value in process.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Example :&lt;/P&gt;
&lt;P&gt;From excel sheet, we take Score = 1 for testcode 41 and try to find it in the dataset column&amp;nbsp; Score1-Score120 , We have "Score1" in dataset =1, so thats a hit, Now we take corresponding Final Score from dataset, in this case "Final_score1" = 74, Now we take 74 and check in excel sheet against testcode 41 and score=1 and see what range it falls in , It falls in row 1 in excel sheet, Now We take value&amp;nbsp; "Low" from there and check "PROF_Level" in dataset if it has the "Low" next to "1".&amp;nbsp; and we have Low next to "1" so&amp;nbsp; we are good, else we flag that record as error.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I know its a lot, But I am not able to get the solution to it, and I am pretty sure Its not a straight forward joins or lookup.&lt;/P&gt;
&lt;P&gt;I am trying and would have tried more myself, I have to complete something on very urgent bases.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please let me know if you need more information.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Appreciate all your help.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;
&lt;P&gt;Manoj&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 15 Oct 2019 00:31:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Lookup-problem-with-multiple-categories/m-p/596397#M171711</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-10-15T00:31:26Z</dc:date>
    </item>
    <item>
      <title>Re: Lookup problem, with multiple categories</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Lookup-problem-with-multiple-categories/m-p/596398#M171712</link>
      <description>FYI - I updated your subject line to be more reflective of your problem.</description>
      <pubDate>Tue, 15 Oct 2019 00:32:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Lookup-problem-with-multiple-categories/m-p/596398#M171712</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-10-15T00:32:06Z</dc:date>
    </item>
    <item>
      <title>Re: Lookup problem, with multiple categories</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Lookup-problem-with-multiple-categories/m-p/596408#M171714</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/134848"&gt;@MKS2204&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;....&lt;/P&gt;
&lt;P&gt;Now I have to check each unique "score" ( from the excel) for the testcode&amp;nbsp; in the dataset columns Score1 - Score120 , If there is a hit, I need to take corresponding "Finalscore" column ( from 120 columns in dataset) and lookup that "Finalscore" against the excel for the same testcode and score , and find out what range of upperlimit and lowerlimit&amp;nbsp; it falls in., Once I have the hit, I need to take the "Proficiency" value from the excel and check that value in dataset "Prof_Level" column , if that value is present in that string along with the Score value in process.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Example :&lt;/P&gt;
&lt;P&gt;From excel sheet, we take Score = 1 for testcode 41 and try to find it in the dataset column&amp;nbsp; Score1-Score120 , We have "Score1" in dataset =1, so thats a hit, Now we take corresponding Final Score from dataset, in this case "Final_score1" = 74, Now we take 74 and check in excel sheet against testcode 41 and score=1 and see what range it falls in , It falls in row 1 in excel sheet, Now We take value&amp;nbsp; "Low" from there and check "PROF_Level" in dataset if it has the "Low" next to "1".&amp;nbsp; and we have Low next to "1" so&amp;nbsp; we are good, else we flag that record as error.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Below a solution for how I understand your requirement.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data ds;
  infile datalines truncover dlm='|';
  input Testcode score1 score2 score120 Final_score1  Final_score2 Final_score120 Prof_level $20. ;
  datalines;
41|1|4.5|23.4|74|230|555|1 Low 2.2 Medium
41|.|5.6|.|450|130|250|2.2 Medium 2 High
51|6.6|2.1|23.4|450|130|555|2.1 Medium 1 Low
;

data Excel;
  infile datalines truncover dlm='|';
  input Testcode Proficiency :$10. MatchScore Lowerlimit Upperlimit $20.;
  datalines;
41|Low|1|50|100
41|Medium|1|101|150
41|High|1|151|200
41|Low|2|75|125
41|Medium|2|126|175
41|High|2|176|200
51|Low|1|50|100
51|Medium|1|101|150
51|High|1|151|200
51|Low|2.1|75|125
51|Medium|2.1|126|175
51|High|2.1|176|200
;

data want(drop=_:);
  if _n_=1 then
    do;
      if 0 then set ds excel;
      dcl hash h1(dataset:'excel', multidata:'y');
      h1.defineKey('Testcode','MatchScore');
      h1.defineData(all:'y');
      h1.defineDone();
    end;
  call missing(of _all_);

  set ds;
  array scores {*} score:;
  array Final_scores {*} Final_score:;

  ScoreMatch_flg=0;
  do _i=1 to dim(scores);
    do while(h1.do_over(key:Testcode,key:scores[_i]) eq 0);
      if lowerlimit&amp;lt;=Final_scores[_i]&amp;lt;=upperlimit then 
        do;
          ScoreMatch_flg= (scores[_i]=input(scan(Prof_level,findw(Prof_level, strip(Proficiency), ' ', 'EI')-1,' '),?? best32.));
          /* once we've found a match don't test any further scores in the observation */
          _i=dim(scores)+1;
          leave;
        end;
    end;
  end;
run;

proc print;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.JPG" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/33136iF3DA123D8C59AAF2/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.JPG" alt="Capture.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&lt;CODE class=" language-sas"&gt;&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&lt;CODE class=" language-sas"&gt;&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&lt;CODE class=" language-sas"&gt;&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&lt;CODE class=" language-sas"&gt;&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 15 Oct 2019 02:41:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Lookup-problem-with-multiple-categories/m-p/596408#M171714</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2019-10-15T02:41:17Z</dc:date>
    </item>
    <item>
      <title>Re: Lookup problem, with multiple categories</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Lookup-problem-with-multiple-categories/m-p/596633#M171814</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;Thank you for updating the post.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/12447"&gt;@Patrick&lt;/a&gt;&amp;nbsp; Thanks Patrick, For taking time to look at it. I am sorry if i was not clear and complete with my requirements, As Reeza mentioned I should have put all information ( I apologize as I am new to posting questions, I will learn) &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have added few more rows to input dataset, &lt;STRONG&gt;and also attached the desired output.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Complete Requirements ( added bold text to it &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I have to check each unique "score" for each testcode ( from the excel)&amp;nbsp; &amp;nbsp;in the dataset columns Score1 - Score120 , If there is a hit, I need to take corresponding "Final score" column ( from 120 columns in dataset) and lookup that "Final score" against the excel for the same testcode and score , and find out what range of upperlimit and lowerlimit&amp;nbsp; it falls in, &lt;STRONG&gt;( If it doesn't fall in any of the range in excel sheet for that test and score, we create a flag called error_Final Score(_i)&amp;nbsp; = 1, also we create a counter effor_flag, )&lt;/STRONG&gt; , If I have the hit, I need to take the "Proficiency" value from the excel and check that value in dataset "Prof_Level" column, &lt;EM&gt;&lt;STRONG&gt;we check the proficiency&amp;nbsp; from excel in Prof_Level only when that "score" is present in the Prof_Level , else we move to next score from excel,&lt;/STRONG&gt;&lt;/EM&gt;&amp;nbsp;&lt;EM&gt;&lt;STRONG&gt;if the "score" is there in Prof_Level then we check Proficiency value from excel next to the matched score in Prof_level and if the value doesn't match we generate error on Prof_Level&lt;/STRONG&gt;&lt;/EM&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;EM&gt;&lt;STRONG&gt;&amp;nbsp;( Error_Prof_Level&amp;nbsp; =1 ) and increment&amp;nbsp;effor_flag+1, if we do not have the "score" from excel that we are checking in this iteration&amp;nbsp;not there in Prof_Level at all , we do not do anything, just move to the next "score" from excel for that test and repeat.&amp;nbsp;&lt;/STRONG&gt;&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;EM&gt;&lt;STRONG&gt;If we have another mismatch like this for that record , we generate error on Prof_Level1 and increment error_flag+1;&lt;/STRONG&gt;&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;STRONG&gt;Note - Because there will be max two proficiency in "Prof_level" column in DS , I created one more column Prof_level1&amp;nbsp; to capture both errors if&amp;nbsp; two matches for a testcode fails.&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Example:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;From excel sheet, we take Score = 1 for testcode 41 and try to find it in the dataset column&amp;nbsp; Score1-Score120 , We have "Score1" in dataset =1, so thats a hit, Now we take corresponding Final Score from dataset, in this case "Final_score1" = 74, Now we take 74 and check in excel sheet against testcode 41 and score=1 and see what range it falls in &lt;STRONG&gt;( If it doesn't fall in any of the range in excel sheet for that test and score, we create a flag called error_Final Score(_i)&amp;nbsp; = 1, also we create a counter say effor_flag, )&lt;/STRONG&gt; , now in our data It falls in row 1 in excel sheet, Now We take value&amp;nbsp; "Low" from there and check "PROF_Level" in dataset if it has the "Low" next to "1".&amp;nbsp; and we have Low next to "1" so&amp;nbsp; we are good, &lt;STRONG&gt;else If we have "score" from excel sheet in "PROF_Level" in dataset but the "proficiency from excel doesn't match with the string next to the score then we generate error, and increment&amp;nbsp;effor_flag+1, if we do not have the "score" from excel that we are checking in this iteration&amp;nbsp;not there in Prof_Level at all , we do not do anything, just move to the next "score" from excel and repeat.&amp;nbsp;&lt;/STRONG&gt;&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;data ds;&lt;BR /&gt;infile datalines truncover dlm='|';&lt;BR /&gt;input Testcode score1 score2 score120 Final_score1 Final_score2 Final_score120 Prof_level ~ $20. Prof_level1 ~ $20. ;&lt;BR /&gt;datalines;&lt;BR /&gt;41|1|4.5|23.4|74|230|555|1 Low 2.2 Medium|1 Low 2.2 Medium&lt;BR /&gt;41|.|5.6|.|450|130|250|2.2 Medium 2 High|2.2 Medium 2 High&lt;BR /&gt;51|6.6|2.1|23.4|450|130|555|2.1 Medium 1 Low|2.1 Medium 1 Low&lt;BR /&gt;51|6.6|2.9|1|450|130|175|1 Medium 1 Low|2.1 Medium 1 Low&lt;BR /&gt;51|1|2|2.1|175|130|175|1 Medium 2 Low|1 Medium 2 Low&lt;BR /&gt;51|1|2|2.1|175|130|175|1 High 2.1 Low|1 High 2.1 Low&lt;BR /&gt;;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;data Excel;&lt;BR /&gt;infile datalines truncover dlm='|';&lt;BR /&gt;input Testcode Proficiency :$10. MatchScore Lowerlimit Upperlimit $20.;&lt;BR /&gt;datalines;&lt;BR /&gt;41|Low|1|50|100&lt;BR /&gt;41|Medium|1|101|150&lt;BR /&gt;41|High|1|151|200&lt;BR /&gt;41|Low|2|75|125&lt;BR /&gt;41|Medium|2|126|175&lt;BR /&gt;41|High|2|176|200&lt;BR /&gt;51|Low|1|50|100&lt;BR /&gt;51|Medium|1|101|150&lt;BR /&gt;51|High|1|151|200&lt;BR /&gt;51|Low|2.1|75|125&lt;BR /&gt;51|Medium|2.1|126|175&lt;BR /&gt;51|High|2.1|176|200&lt;BR /&gt;;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Example below should not flag an error as there is no match of the score ( 2.1 ) in the "Prof_Level" column (1 &amp;amp; 2.2 ).&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;data ds;&lt;BR /&gt;infile datalines truncover dlm='|';&lt;BR /&gt;input Testcode score1 score2 score120 Final_score1 Final_score2 Final_score120 Prof_level ~ $20.&amp;nbsp;Prof_level ~ $20. ;&lt;BR /&gt;datalines;&lt;BR /&gt;51|6.6|2.1|23.4|450|130|555|1 Low &lt;STRONG&gt;2.2&lt;/STRONG&gt; Medium|1 Low &lt;STRONG&gt;2.2&lt;/STRONG&gt; Medium&lt;BR /&gt;;&lt;/P&gt;&lt;P&gt;data Excel;&lt;BR /&gt;infile datalines truncover dlm='|';&lt;BR /&gt;input Testcode Proficiency :$10. MatchScore Lowerlimit Upperlimit $20.;&lt;BR /&gt;datalines;&lt;BR /&gt;51|Low|2.1|75|125&lt;BR /&gt;51|Medium|2.1|126|175&lt;BR /&gt;51|High|2.1|176|200&lt;BR /&gt;;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Desired output:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Desired_Result.JPG" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/33165i5FCCE0DA21E47543/image-size/large?v=v2&amp;amp;px=999" role="button" title="Desired_Result.JPG" alt="Desired_Result.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It would be great if you can please help on this. Appreciate all your help, have a nice day.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Manoj&lt;/P&gt;</description>
      <pubDate>Wed, 16 Oct 2019 17:12:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Lookup-problem-with-multiple-categories/m-p/596633#M171814</guid>
      <dc:creator>MKS2204</dc:creator>
      <dc:date>2019-10-16T17:12:55Z</dc:date>
    </item>
    <item>
      <title>Re: Lookup problem, with multiple categories</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Lookup-problem-with-multiple-categories/m-p/597174#M172047</link>
      <description>&lt;P&gt;Hi, Request everyone to please have a look at the problem, Appreciate your help.&lt;/P&gt;</description>
      <pubDate>Thu, 17 Oct 2019 05:11:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Lookup-problem-with-multiple-categories/m-p/597174#M172047</guid>
      <dc:creator>MKS2204</dc:creator>
      <dc:date>2019-10-17T05:11:05Z</dc:date>
    </item>
    <item>
      <title>Re: Lookup problem, with multiple categories</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Lookup-problem-with-multiple-categories/m-p/597200#M172063</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/134848"&gt;@MKS2204&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi, Request everyone to please have a look at the problem, Appreciate your help.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Just to explain to you why I'm not answering: There is just too much in your question for me to get my head around within reasonable time. You get normally more answers quicker if you break a problem apart, then try to first solve the steps yourself and ask targeted questions for where you get stuck.&lt;/P&gt;
&lt;P&gt;It's also normally a good idea to not only post sample data and desired output but to also post your code (fully working or not) and explain where you got stuck. Posting your own code also lets us better understand on what level you are so we can provide answers which you can understand.&lt;/P&gt;</description>
      <pubDate>Thu, 17 Oct 2019 08:04:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Lookup-problem-with-multiple-categories/m-p/597200#M172063</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2019-10-17T08:04:43Z</dc:date>
    </item>
    <item>
      <title>Re: Lookup problem, with multiple categories</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Lookup-problem-with-multiple-categories/m-p/597201#M172064</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/134848"&gt;@MKS2204&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi, Request everyone to please have a look at the problem, Appreciate your help.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Fully agree to &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/12447"&gt;@Patrick&lt;/a&gt;s comment. The problem is to big to be worked on in my spare time.&lt;/P&gt;</description>
      <pubDate>Thu, 17 Oct 2019 07:42:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Lookup-problem-with-multiple-categories/m-p/597201#M172064</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2019-10-17T07:42:51Z</dc:date>
    </item>
    <item>
      <title>Re: Lookup problem, with multiple categories</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Lookup-problem-with-multiple-categories/m-p/597438#M172143</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/15475"&gt;@andreas_lds&lt;/a&gt;&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/12447"&gt;@Patrick&lt;/a&gt;&amp;nbsp; I understand what you guys are saying, and I understand it,&amp;nbsp; I tried myself a lot, was trying very lengthy methods, of transposing and then joins etc but could not join horizontal data in DS to vertical scores in Excel. I never used hash which seems to be the solution here . I have a deliverable based on this requirement so I got desperate to get the solution, and wrote the whole big requirement, which I know doesn't seem right.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I know everyone has time constraints, But thank you for taking time out, I got the lead , working on this, If I get stuck somewhere I will ask for your opinion, if you find time, It will be highly appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Have a Good One.&lt;/P&gt;&lt;P&gt;Manoj&lt;/P&gt;</description>
      <pubDate>Thu, 17 Oct 2019 17:02:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Lookup-problem-with-multiple-categories/m-p/597438#M172143</guid>
      <dc:creator>MKS2204</dc:creator>
      <dc:date>2019-10-17T17:02:42Z</dc:date>
    </item>
    <item>
      <title>Re: Lookup problem, with multiple categories</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Lookup-problem-with-multiple-categories/m-p/597489#M172159</link>
      <description>Hash is a solution that someone posted but not necessarily required. Your format is part of the issue for sure, I would recommend switching your first file to a long format rather than wide format and trying a join at that point.</description>
      <pubDate>Thu, 17 Oct 2019 20:20:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Lookup-problem-with-multiple-categories/m-p/597489#M172159</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-10-17T20:20:08Z</dc:date>
    </item>
    <item>
      <title>Re: Lookup problem, with multiple categories</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Lookup-problem-with-multiple-categories/m-p/601520#M173997</link>
      <description>&lt;P&gt;Thank you All.&lt;/P&gt;</description>
      <pubDate>Mon, 04 Nov 2019 21:34:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Lookup-problem-with-multiple-categories/m-p/601520#M173997</guid>
      <dc:creator>MKS2204</dc:creator>
      <dc:date>2019-11-04T21:34:17Z</dc:date>
    </item>
  </channel>
</rss>

