<?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: &amp;quot;Like&amp;quot; function in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/quot-Like-quot-function/m-p/800655#M315017</link>
    <description>&lt;P&gt;Use double quotes&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;	where LB_DOS like "%&amp;amp;DatePubli2";&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Macro variables do not resolve inside of single quotes.&lt;/P&gt;</description>
    <pubDate>Mon, 07 Mar 2022 14:31:17 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2022-03-07T14:31:17Z</dc:date>
    <item>
      <title>"Like" function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/quot-Like-quot-function/m-p/800642#M315011</link>
      <description>&lt;P&gt;Hello Experts,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm looking in my data LB_DOS for the rows with : "xxxxxx 31/12/2021". The macro variable &amp;amp;DatePubli2. has the value 31/12/2021, but my code doesn't work :&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%put test &amp;amp;DatePubli2.;  /***test 31/12/2021***/


data DOSS3;
	set DOSS2;
	where LB_DOS like '%&amp;amp;DatePubli2.';
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Nor this :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data DOSS3;
	set DOSS2;
	if  prxmatch("m/&amp;amp;DatePubli2./oi",LB_DOS)&amp;gt; 0 
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Thank you for your help !&lt;/P&gt;</description>
      <pubDate>Mon, 07 Mar 2022 14:00:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/quot-Like-quot-function/m-p/800642#M315011</guid>
      <dc:creator>SASdevAnneMarie</dc:creator>
      <dc:date>2022-03-07T14:00:19Z</dc:date>
    </item>
    <item>
      <title>Re: "Like" function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/quot-Like-quot-function/m-p/800644#M315012</link>
      <description>&lt;P&gt;We need to know the values of LB_DOS in data set DOSS2, and how this variable is formatted. If the variable is formatted as DDMMYY. or similar, you can't use LIKE because that works on character strings and your data variable is not a character string but a numeric. But that's a guess by me, so ...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please show us typical values of LB_DOS in data set DOSS2, and also PROC CONTENTS output for this variable.&lt;/P&gt;</description>
      <pubDate>Mon, 07 Mar 2022 14:05:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/quot-Like-quot-function/m-p/800644#M315012</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-03-07T14:05:58Z</dc:date>
    </item>
    <item>
      <title>Re: "Like" function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/quot-Like-quot-function/m-p/800647#M315013</link>
      <description>Thank you for the message. The values in the column are &lt;BR /&gt;LB_DOS (1 column, 3 rows for example) &lt;BR /&gt;Test on 31/12/2021&lt;BR /&gt;Test on 09/12/2021&lt;BR /&gt;Test  on 01/12/2009&lt;BR /&gt;</description>
      <pubDate>Mon, 07 Mar 2022 14:10:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/quot-Like-quot-function/m-p/800647#M315013</guid>
      <dc:creator>SASdevAnneMarie</dc:creator>
      <dc:date>2022-03-07T14:10:50Z</dc:date>
    </item>
    <item>
      <title>Re: "Like" function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/quot-Like-quot-function/m-p/800651#M315015</link>
      <description>&lt;P&gt;What does PROC CONTENTS show you about this variable in data set DOSS2?&lt;/P&gt;</description>
      <pubDate>Mon, 07 Mar 2022 14:20:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/quot-Like-quot-function/m-p/800651#M315015</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-03-07T14:20:09Z</dc:date>
    </item>
    <item>
      <title>Re: "Like" function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/quot-Like-quot-function/m-p/800653#M315016</link>
      <description>Thank you for the message. The result of proc contents is : LB_DOS Char 50 $50. $50. LB_DOS</description>
      <pubDate>Mon, 07 Mar 2022 14:22:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/quot-Like-quot-function/m-p/800653#M315016</guid>
      <dc:creator>SASdevAnneMarie</dc:creator>
      <dc:date>2022-03-07T14:22:50Z</dc:date>
    </item>
    <item>
      <title>Re: "Like" function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/quot-Like-quot-function/m-p/800655#M315017</link>
      <description>&lt;P&gt;Use double quotes&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;	where LB_DOS like "%&amp;amp;DatePubli2";&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Macro variables do not resolve inside of single quotes.&lt;/P&gt;</description>
      <pubDate>Mon, 07 Mar 2022 14:31:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/quot-Like-quot-function/m-p/800655#M315017</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-03-07T14:31:17Z</dc:date>
    </item>
    <item>
      <title>Re: "Like" function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/quot-Like-quot-function/m-p/800657#M315018</link>
      <description>But unfortunately, I have 0 lines ..</description>
      <pubDate>Mon, 07 Mar 2022 14:40:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/quot-Like-quot-function/m-p/800657#M315018</guid>
      <dc:creator>SASdevAnneMarie</dc:creator>
      <dc:date>2022-03-07T14:40:11Z</dc:date>
    </item>
    <item>
      <title>Re: "Like" function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/quot-Like-quot-function/m-p/800658#M315019</link>
      <description>&lt;P&gt;Show us the log, include the code as it appears in the log. Copy the log as text and use the &amp;lt;/&amp;gt; icon to include the log in your reply.&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" image-alt="2021-11-26 08_27_29-Reply to Message - SAS Support Communities — Mozilla Firefox.png" style="width: 859px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/66123iA4EF494F9CA0F6EE/image-size/large?v=v2&amp;amp;px=999" role="button" title="2021-11-26 08_27_29-Reply to Message - SAS Support Communities — Mozilla Firefox.png" alt="2021-11-26 08_27_29-Reply to Message - SAS Support Communities — Mozilla Firefox.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;From now on, when code isn't working properly, show us the log so we can see the code in the log and any ERRORs, WARNINGs and NOTEs. Don't make us ask you to show us the log; do it automatically from now on when code isn't working.&lt;/P&gt;</description>
      <pubDate>Mon, 07 Mar 2022 14:46:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/quot-Like-quot-function/m-p/800658#M315019</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-03-07T14:46:17Z</dc:date>
    </item>
    <item>
      <title>Re: "Like" function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/quot-Like-quot-function/m-p/800663#M315020</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;28         data DOSS3;
29         	set DOSS2;
30         	where LB_DOS like "%&amp;amp;DatePubli2";
SYMBOLGEN:  Macro variable DATEPUBLI2 resolves to 31/12/2021
31         run;

NOTE: There were 0 observations read from the data set WORK.DOSS2.
      WHERE LB_DOS like '%&amp;amp;DatePubli2';
NOTE: The data set WORK.DOSS3 has 0 observations and 31 variables.
NOTE: DATA statement used (Total process time):
      real time           0.01 seconds
      cpu time            0.01 seconds
      &lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 07 Mar 2022 14:52:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/quot-Like-quot-function/m-p/800663#M315020</guid>
      <dc:creator>SASdevAnneMarie</dc:creator>
      <dc:date>2022-03-07T14:52:44Z</dc:date>
    </item>
    <item>
      <title>Re: "Like" function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/quot-Like-quot-function/m-p/800665#M315021</link>
      <description>&lt;P&gt;Since the field is 50 bytes long and you are only using a wildcard at the start then perhaps there are invisible characters after the date string.&amp;nbsp; Such as TAB, CR, LF , Non-breaking space, null character.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Does it help to add the % after the date?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Or perhaps the macro variable has leading spaces.&amp;nbsp; That can happen if you use the older CALL SYMPUT() function instead of the modern CALL SYMPUTX() function to create the macro variable.&amp;nbsp; It also also happen if you use PROC SQL INTO without the TRIMMED keyword.&amp;nbsp; The message generated by the SYMBOLGEN option will not show the leading spaces.&amp;nbsp; To see them use %PUT and add some visible characters before and after the macro variable reference.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%put |&amp;amp;DatePubli2|;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 07 Mar 2022 15:13:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/quot-Like-quot-function/m-p/800665#M315021</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-03-07T15:13:48Z</dc:date>
    </item>
    <item>
      <title>Re: "Like" function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/quot-Like-quot-function/m-p/800666#M315022</link>
      <description>&lt;P&gt;I don't have your data, and so can't test the code against your data. This works for me when I try to find records that have NAME end with ne from SASHELP.CLASS.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let char=ne;

data a;
    set sashelp.class;
    where name like "%nrstr(%%)&amp;amp;char";
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;So please try the %nrstr(%%) in your code to replace the single % sign before macro variable &amp;amp;datepubli2.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If that's not it either, then we need to see a portion of data set DOSS2 provided according to &lt;A href="https://blogs.sas.com/content/sastraining/2016/03/11/jedi-sas-tricks-data-to-data-step-macro/" target="_self"&gt;these instructions&lt;/A&gt;. Many people just ignore the instructions when I mention it. Please do not provide the data in any other manner, as that won't help, and we'll just ask you to follow the instructions again.&lt;/P&gt;</description>
      <pubDate>Mon, 07 Mar 2022 15:30:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/quot-Like-quot-function/m-p/800666#M315022</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-03-07T15:30:14Z</dc:date>
    </item>
  </channel>
</rss>

