<?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: Converting Like operator in Where to Data step If then else [how to improve your question] in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Converting-Like-operator-in-Where-to-Data-step-If-then-else/m-p/588533#M168213</link>
    <description>&lt;P&gt;Hello &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/16518"&gt;@keen_sas&lt;/a&gt;,&lt;/P&gt;&lt;BR /&gt; &lt;P&gt;Your question requires more details before experts can help.&amp;nbsp;Can you revise your question to include more information?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Review this checklist:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Specify a meaningful subject line for your topic.&amp;nbsp; Avoid generic subjects like "need help," "SAS query," or "urgent."&lt;/LI&gt;
&lt;LI&gt;When appropriate, provide sample data in text or DATA step format.&amp;nbsp; See &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;this article for one method&lt;/A&gt;&amp;nbsp;you can use.&lt;/LI&gt;
&lt;LI&gt;If you're encountering an error in SAS, include the SAS log or a screenshot of the error condition.&amp;nbsp;Use the&amp;nbsp;&lt;STRONG&gt;Photos&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;button to include the image in your message.&lt;BR /&gt;&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-inline" style="width: 279px;"&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/16608i91A52F817EAC9A69/image-dimensions/279x150?v=1.0" width="279" height="150" alt="use_buttons.png" title="use_buttons.png" /&gt;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;It also helps to include an example (table or picture) of the result that you're trying to achieve.&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;To edit your original message, select the "blue gear" icon at the top of the message and select&amp;nbsp;&lt;STRONG&gt;Edit Message&lt;/STRONG&gt;.&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&lt;/STRONG&gt;From there you can adjust the title and add more details to the body of the message.&amp;nbsp; Or, simply reply to this message with any additional information you can supply.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-inline" style="width: 229px;"&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/16605iAC020BC79315B045/image-size/large?v=1.0&amp;amp;px=600" alt="edit_post.png" title="edit_post.png" /&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;SAS experts are eager to help -- help&amp;nbsp;&lt;EM&gt;them&lt;/EM&gt; by providing as much detail as you can.&lt;/P&gt; &lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-style:italic;font-size:smaller;"&gt;This prewritten response was triggered for you by fellow SAS Support Communities member &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt;&lt;/SPAN&gt;&lt;/P&gt;.</description>
    <pubDate>Fri, 13 Sep 2019 14:10:19 GMT</pubDate>
    <dc:creator>Community_Guide</dc:creator>
    <dc:date>2019-09-13T14:10:19Z</dc:date>
    <item>
      <title>Converting Like operator in Where to Data step If then else</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Converting-Like-operator-in-Where-to-Data-step-If-then-else/m-p/588527#M168211</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;data test ;&lt;BR /&gt;length have want $1000.;&lt;BR /&gt;HAVE='WHERE aeout like "%RECOVERED%";';&lt;BR /&gt;WANT="if find(aeout , 'RECOVERED' ,'i') &amp;gt;0;";&lt;BR /&gt;output;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;HAVE='where aeout not like "%RECOVERED%" and aeacn like "%DOSE%";';&lt;BR /&gt;WANT="if not find(aeout,'RECOVERED','i')&amp;gt;0 and find(aeacn,'DOSE','i')&amp;gt; 0";&lt;BR /&gt;output;&lt;BR /&gt;&lt;BR /&gt;HAVE='WHERE aeout not like "%RECOVERED%" and aeacn not like "%DOSE%" and not (aeacn like "%DRUG%" or AEPRA = "Y");';&lt;BR /&gt;WANT="if not find(aeout,'RECOVERED','i')&amp;gt;0 and not find(aeacn,'DOSE','i')&amp;gt;0 and not (find(aeacn,'DRUG','i')&amp;gt;0 or AEPRA = 'Y');";&lt;BR /&gt;output;&lt;/P&gt;
&lt;P&gt;run ;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As per my specification all the conditions/logics were given in compatible with SQL statements , and based on that condition have to create new variable. The condition (present in HAVE variable) works prefectly uisng PROC SQL , CASE when statements ( for creating new varaible) . But my macro was already designed for data step if then else statements , so i cannot use the above statement(HAVE) in my macro. I am trying to convert that SQL compatible statement in to if then else statement&lt;BR /&gt;as present in WANT statement. All the condition are present in one data step , i have to convert them automatically into if then else compatible statement so that i can use them (WANT) in my macro without any modifications.&lt;/P&gt;
&lt;P&gt;I am trying to convert the &lt;STRONG&gt;HAVE statement&lt;/STRONG&gt; (PROC SQL compatible syntax) into &lt;STRONG&gt;WANT statement&lt;/STRONG&gt; (Data step if -then else statement) &lt;STRONG&gt;in SAS automatically&lt;/STRONG&gt;. Any suggestions how to convert it automatically through SAS as standardization process?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 13 Sep 2019 13:50:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Converting-Like-operator-in-Where-to-Data-step-If-then-else/m-p/588527#M168211</guid>
      <dc:creator>keen_sas</dc:creator>
      <dc:date>2019-09-13T13:50:10Z</dc:date>
    </item>
    <item>
      <title>Re: Converting Like operator in Where to Data step If then else [how to improve your question]</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Converting-Like-operator-in-Where-to-Data-step-If-then-else/m-p/588533#M168213</link>
      <description>&lt;P&gt;Hello &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/16518"&gt;@keen_sas&lt;/a&gt;,&lt;/P&gt;&lt;BR /&gt; &lt;P&gt;Your question requires more details before experts can help.&amp;nbsp;Can you revise your question to include more information?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Review this checklist:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Specify a meaningful subject line for your topic.&amp;nbsp; Avoid generic subjects like "need help," "SAS query," or "urgent."&lt;/LI&gt;
&lt;LI&gt;When appropriate, provide sample data in text or DATA step format.&amp;nbsp; See &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;this article for one method&lt;/A&gt;&amp;nbsp;you can use.&lt;/LI&gt;
&lt;LI&gt;If you're encountering an error in SAS, include the SAS log or a screenshot of the error condition.&amp;nbsp;Use the&amp;nbsp;&lt;STRONG&gt;Photos&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;button to include the image in your message.&lt;BR /&gt;&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-inline" style="width: 279px;"&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/16608i91A52F817EAC9A69/image-dimensions/279x150?v=1.0" width="279" height="150" alt="use_buttons.png" title="use_buttons.png" /&gt;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;It also helps to include an example (table or picture) of the result that you're trying to achieve.&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;To edit your original message, select the "blue gear" icon at the top of the message and select&amp;nbsp;&lt;STRONG&gt;Edit Message&lt;/STRONG&gt;.&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&lt;/STRONG&gt;From there you can adjust the title and add more details to the body of the message.&amp;nbsp; Or, simply reply to this message with any additional information you can supply.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-inline" style="width: 229px;"&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/16605iAC020BC79315B045/image-size/large?v=1.0&amp;amp;px=600" alt="edit_post.png" title="edit_post.png" /&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;SAS experts are eager to help -- help&amp;nbsp;&lt;EM&gt;them&lt;/EM&gt; by providing as much detail as you can.&lt;/P&gt; &lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-style:italic;font-size:smaller;"&gt;This prewritten response was triggered for you by fellow SAS Support Communities member &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt;&lt;/SPAN&gt;&lt;/P&gt;.</description>
      <pubDate>Fri, 13 Sep 2019 14:10:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Converting-Like-operator-in-Where-to-Data-step-If-then-else/m-p/588533#M168213</guid>
      <dc:creator>Community_Guide</dc:creator>
      <dc:date>2019-09-13T14:10:19Z</dc:date>
    </item>
    <item>
      <title>Re: Converting Like operator in Where to Data step If then else</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Converting-Like-operator-in-Where-to-Data-step-If-then-else/m-p/588569#M168222</link>
      <description>&lt;P&gt;A data step can have WHERE statements.&amp;nbsp; If you have multiple WHERE statements chain them with an WHERE SAME AND or add &amp;amp; between the criteria's and remove the word WHERE.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
set sashelp.class;
where name like 'A%';
where same and age in (12:18);
run; &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;or replace the WHERE with an AND. I would also add parenthesis to ensure correct resolution of your criteria's.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
set sashelp.class;
where (name like 'A%')
/*WHERE*/ and (age in (12:18));
run; &lt;/CODE&gt;&lt;/PRE&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/16518"&gt;@keen_sas&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi all,&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;data test ;&lt;BR /&gt;length have want $1000.;&lt;BR /&gt;HAVE='WHERE aeout like "%RECOVERED%";';&lt;BR /&gt;WANT="if find(aeout , 'RECOVERED' ,'i') &amp;gt;0;";&lt;BR /&gt;output;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;HAVE='where aeout not like "%RECOVERED%" and aeacn like "%DOSE%";';&lt;BR /&gt;WANT="if not find(aeout,'RECOVERED','i')&amp;gt;0 and find(aeacn,'DOSE','i')&amp;gt; 0";&lt;BR /&gt;output;&lt;BR /&gt;&lt;BR /&gt;HAVE='WHERE aeout not like "%RECOVERED%" and aeacn not like "%DOSE%" and not (aeacn like "%DRUG%" or AEPRA = "Y");';&lt;BR /&gt;WANT="if not find(aeout,'RECOVERED','i')&amp;gt;0 and not find(aeacn,'DOSE','i')&amp;gt;0 and not (find(aeacn,'DRUG','i')&amp;gt;0 or AEPRA = 'Y');";&lt;BR /&gt;output;&lt;/P&gt;
&lt;P&gt;run ;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As per my specification all the conditions/logics were given in compatible with SQL statements , and based on that condition have to create new variable. The condition (present in HAVE variable) works prefectly uisng PROC SQL , CASE when statements ( for creating new varaible) . But my macro was already designed for data step if then else statements , so i cannot use the above statement(HAVE) in my macro. I am trying to convert that SQL compatible statement in to if then else statement&lt;BR /&gt;as present in WANT statement. All the condition are present in one data step , i have to convert them automatically into if then else compatible statement so that i can use them (WANT) in my macro without any modifications.&lt;/P&gt;
&lt;P&gt;I am trying to convert the &lt;STRONG&gt;HAVE statement&lt;/STRONG&gt; (PROC SQL compatible syntax) into &lt;STRONG&gt;WANT statement&lt;/STRONG&gt; (Data step if -then else statement) &lt;STRONG&gt;in SAS automatically&lt;/STRONG&gt;. Any suggestions how to convert it automatically through SAS as standardization process?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 13 Sep 2019 15:24:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Converting-Like-operator-in-Where-to-Data-step-If-then-else/m-p/588569#M168222</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-09-13T15:24:12Z</dc:date>
    </item>
  </channel>
</rss>

