<?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: how to use &amp;quot;not like&amp;quot; operator to work with a list in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/how-to-use-quot-not-like-quot-operator-to-work-with-a-list/m-p/700131#M79843</link>
    <description>&lt;P&gt;Maybe using the first function makes the last when statement easier:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;when first(Grade_Awarded) not in ('D', 'F', 'W') then 'non-DFW'&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Moving the logic into a format definition sounds like a good idea (code is untested)&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format;
  value $GradeType
    'D', 'F' = 'DF Grades'
	'W' = 'W Grades'
	other = 'non-DFW'
  ;
run;

data courses;
  set courses_taken;
  
  length Grade_Type $ 10;
  
  Grade_Type = put(first(Grade_Awarded), $GradeType.);
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 19 Nov 2020 07:35:25 GMT</pubDate>
    <dc:creator>andreas_lds</dc:creator>
    <dc:date>2020-11-19T07:35:25Z</dc:date>
    <item>
      <title>how to use "not like" operator to work with a list</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/how-to-use-quot-not-like-quot-operator-to-work-with-a-list/m-p/700085#M79841</link>
      <description>&lt;P&gt;I try to use "not like" operator in case when statement in proc sql,&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC SQL;
CREATE TABLE COURSES AS
SELECT ID,
               CASE WHEN GRADE_AWARDED LIKE 'D%' OR GRADE_AWARDED LIKE 'F%' THEN 'DF Grades'
	                WHEN GRADE_AWARDED LIKE 'W%' THEN 'W Grades'
			        WHEN GRADE_AWARDED NOT (LIKE 'D%' or LIKE 'F%' OR LIKE 'W%') THEN 'non-DFW'
			        ELSE 'No Grade' END AS Grade_Type
FROM COURSES_TAKEN;
QUIT;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;but I am getting error message: any idea how should I modify this code? Thanks!&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="xliu1_0-1605757068968.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/51822i338097148FAFC098/image-size/medium?v=v2&amp;amp;px=400" role="button" title="xliu1_0-1605757068968.png" alt="xliu1_0-1605757068968.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Nov 2020 03:39:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/how-to-use-quot-not-like-quot-operator-to-work-with-a-list/m-p/700085#M79841</guid>
      <dc:creator>xliu1</dc:creator>
      <dc:date>2020-11-19T03:39:42Z</dc:date>
    </item>
    <item>
      <title>Re: how to use "not like" operator to work with a list</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/how-to-use-quot-not-like-quot-operator-to-work-with-a-list/m-p/700125#M79842</link>
      <description>&lt;P&gt;The Like Operator handles one expresion one time. Therefore, this is the correct syntax&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC SQL;
CREATE TABLE COURSES AS
SELECT ID,
               CASE WHEN GRADE_AWARDED LIKE 'D%' OR GRADE_AWARDED LIKE 'F%' THEN 'DF Grades'
	                 WHEN GRADE_AWARDED LIKE 'W%' THEN 'W Grades'
			           WHEN  GRADE_AWARDED NOT LIKE 'D%' 
                       or GRADE_AWARDED NOT LIKE 'F%' 
                       or GRADE_AWARDED NOT LIKE 'W%') THEN 'non-DFW'
			      ELSE 'No Grade' END AS Grade_Type
FROM COURSES_TAKEN;
QUIT;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 19 Nov 2020 07:16:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/how-to-use-quot-not-like-quot-operator-to-work-with-a-list/m-p/700125#M79842</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2020-11-19T07:16:31Z</dc:date>
    </item>
    <item>
      <title>Re: how to use "not like" operator to work with a list</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/how-to-use-quot-not-like-quot-operator-to-work-with-a-list/m-p/700131#M79843</link>
      <description>&lt;P&gt;Maybe using the first function makes the last when statement easier:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;when first(Grade_Awarded) not in ('D', 'F', 'W') then 'non-DFW'&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Moving the logic into a format definition sounds like a good idea (code is untested)&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format;
  value $GradeType
    'D', 'F' = 'DF Grades'
	'W' = 'W Grades'
	other = 'non-DFW'
  ;
run;

data courses;
  set courses_taken;
  
  length Grade_Type $ 10;
  
  Grade_Type = put(first(Grade_Awarded), $GradeType.);
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 19 Nov 2020 07:35:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/how-to-use-quot-not-like-quot-operator-to-work-with-a-list/m-p/700131#M79843</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2020-11-19T07:35:25Z</dc:date>
    </item>
    <item>
      <title>Re: how to use "not like" operator to work with a list</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/how-to-use-quot-not-like-quot-operator-to-work-with-a-list/m-p/700200#M79844</link>
      <description>&lt;P&gt;Thanks! using first function works out in my program.&lt;/P&gt;</description>
      <pubDate>Thu, 19 Nov 2020 14:17:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/how-to-use-quot-not-like-quot-operator-to-work-with-a-list/m-p/700200#M79844</guid>
      <dc:creator>xliu1</dc:creator>
      <dc:date>2020-11-19T14:17:06Z</dc:date>
    </item>
  </channel>
</rss>

