<?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: in: and macro not working in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/in-and-macro-not-working/m-p/511893#M137786</link>
    <description>Actually you're misunderstanding how IN works, it won't work how you've designed it here - it matches from the beginning of the strings and your text is in the middle. You can use LIKE instead with SQL - no need to create macro variables then. There's some examples of how to do that on here in previous questions. &lt;BR /&gt;</description>
    <pubDate>Sat, 10 Nov 2018 01:16:35 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2018-11-10T01:16:35Z</dc:date>
    <item>
      <title>in: and macro not working</title>
      <link>https://communities.sas.com/t5/SAS-Programming/in-and-macro-not-working/m-p/511875#M137775</link>
      <description>&lt;P&gt;I am trying to capture a phrase from my dataset that includes a bunch of terms. I am using PROC SQL to get the list of variables separated by a comma. I need to use this phrase in a SAS function with IN: (which I believe finds instances that carry the relevant string). But the code gives me 0 observations despite having variables in my data.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SAS DATA STEP:&lt;/P&gt;
&lt;P&gt;proc sql noprint;&lt;BR /&gt;select upcase("'"||STRIP(toxxx)||"'") into:neurolist separated by ', '&lt;/P&gt;
&lt;P&gt;from test;quit;&lt;BR /&gt;%put &amp;amp;neurolist;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;LOG:&lt;/P&gt;
&lt;P&gt;Macro variable NEUROLIST resolves to 'CONFUSION', 'DIZZINESS', 'HEADACHE', 'INSOMNIA', 'MEMORY IMPAIRMENT', 'TREMOR'&lt;BR /&gt;6767 %put &amp;amp;neurolist;&lt;BR /&gt;'CONFUSION', 'DIZZINESS', 'HEADACHE', 'INSOMNIA', 'MEMORY IMPAIRMENT', 'TREMOR'.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The codes doesn't get me an error. It works, but doesn't have any observations.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;NOTE: There were 227 observations read from the data set WORK.MEDS_NEURO.&lt;BR /&gt;NOTE: The data set WORK.NEURODEX has 0 observations and 7 variables.&lt;BR /&gt;NOTE: DATA statement used (Total process time):&lt;BR /&gt;real time 0.00 seconds&lt;BR /&gt;cpu time 0.03 seconds&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please see attachment for my dataset that has the term "HEADACHE", but my code doesn't capture it. Any idea why?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-left" image-alt="screenshot.JPG" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/24806i0601CAE194CBA59A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="screenshot.JPG" alt="screenshot.JPG" /&gt;&lt;/span&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Nov 2018 23:11:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/in-and-macro-not-working/m-p/511875#M137775</guid>
      <dc:creator>saslove</dc:creator>
      <dc:date>2018-11-09T23:11:02Z</dc:date>
    </item>
    <item>
      <title>Re: in: and macro not working</title>
      <link>https://communities.sas.com/t5/SAS-Programming/in-and-macro-not-working/m-p/511877#M137777</link>
      <description>&lt;P&gt;You've shown the log from the part of the program that works.&amp;nbsp; That's a good start.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want help in debugging the program, you will need to show the log from the part of the program that doesn't work.&lt;/P&gt;</description>
      <pubDate>Fri, 09 Nov 2018 23:17:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/in-and-macro-not-working/m-p/511877#M137777</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-11-09T23:17:44Z</dc:date>
    </item>
    <item>
      <title>Re: in: and macro not working</title>
      <link>https://communities.sas.com/t5/SAS-Programming/in-and-macro-not-working/m-p/511879#M137778</link>
      <description>&lt;P&gt;Where is the data step code? Also show examples of the data you are searching.&lt;/P&gt;
&lt;P&gt;Make sure to use the Insert Code or Insert SAS Code icons on the menu to open a pop-window to enter your text so that formatting is preserved.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Nov 2018 23:29:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/in-and-macro-not-working/m-p/511879#M137778</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2018-11-09T23:29:07Z</dc:date>
    </item>
    <item>
      <title>Re: in: and macro not working</title>
      <link>https://communities.sas.com/t5/SAS-Programming/in-and-macro-not-working/m-p/511880#M137779</link>
      <description>The code you're showing creates a macro variable and doesn't do anything beyond that, its not set up to do anything. If you have other code, please post that.</description>
      <pubDate>Fri, 09 Nov 2018 23:32:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/in-and-macro-not-working/m-p/511880#M137779</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-11-09T23:32:01Z</dc:date>
    </item>
    <item>
      <title>Re: in: and macro not working</title>
      <link>https://communities.sas.com/t5/SAS-Programming/in-and-macro-not-working/m-p/511881#M137780</link>
      <description>&lt;P&gt;I think you don't need the macro variable at all. Please try:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table neurodex as
select a.*, b.toxxx
from meds_neuro as a, test as b
where a.cmindco contains upcase(strip(b.toxxx));
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 09 Nov 2018 23:33:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/in-and-macro-not-working/m-p/511881#M137780</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2018-11-09T23:33:32Z</dc:date>
    </item>
    <item>
      <title>Re: in: and macro not working</title>
      <link>https://communities.sas.com/t5/SAS-Programming/in-and-macro-not-working/m-p/511891#M137784</link>
      <description>As I had mentioned in the post , the program executed but gave me no observations. Log is clear.&lt;BR /&gt;</description>
      <pubDate>Sat, 10 Nov 2018 01:10:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/in-and-macro-not-working/m-p/511891#M137784</guid>
      <dc:creator>saslove</dc:creator>
      <dc:date>2018-11-10T01:10:10Z</dc:date>
    </item>
    <item>
      <title>Re: in: and macro not working</title>
      <link>https://communities.sas.com/t5/SAS-Programming/in-and-macro-not-working/m-p/511892#M137785</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/1717"&gt;@saslove&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;As I had mentioned in the post , the program executed but gave me no observations. Log is clear.&lt;BR /&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;You didn't show any code and there's no attachment. You're probably doing something wrong but since we can't see the code, data or log&amp;nbsp;your guess is as good as ours at the moment.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 10 Nov 2018 01:14:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/in-and-macro-not-working/m-p/511892#M137785</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-11-10T01:14:26Z</dc:date>
    </item>
    <item>
      <title>Re: in: and macro not working</title>
      <link>https://communities.sas.com/t5/SAS-Programming/in-and-macro-not-working/m-p/511893#M137786</link>
      <description>Actually you're misunderstanding how IN works, it won't work how you've designed it here - it matches from the beginning of the strings and your text is in the middle. You can use LIKE instead with SQL - no need to create macro variables then. There's some examples of how to do that on here in previous questions. &lt;BR /&gt;</description>
      <pubDate>Sat, 10 Nov 2018 01:16:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/in-and-macro-not-working/m-p/511893#M137786</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-11-10T01:16:35Z</dc:date>
    </item>
    <item>
      <title>Re: in: and macro not working</title>
      <link>https://communities.sas.com/t5/SAS-Programming/in-and-macro-not-working/m-p/511927#M137805</link>
      <description>&lt;P&gt;Your values have to exactly match how they exists in the dataset ie. HEADACHE is not equal to NEUROTOXICITY(HEADACHE).&lt;/P&gt;
&lt;P&gt;So you may have to use index() or find() or prxmatch() to find a word in a string.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql noprint;
select STRIP(toxxx) into:neurolist separated by '|'

from test;quit;
%put &amp;amp;neurolist;

proc sql;
create table neurodex as
select a.*, b.toxxx
from meds_neuro as a, test as b
where prxmatch("m/&amp;amp;neurolist/io",a.cmindco)&amp;gt;0;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 10 Nov 2018 14:52:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/in-and-macro-not-working/m-p/511927#M137805</guid>
      <dc:creator>SuryaKiran</dc:creator>
      <dc:date>2018-11-10T14:52:08Z</dc:date>
    </item>
    <item>
      <title>Re: in: and macro not working</title>
      <link>https://communities.sas.com/t5/SAS-Programming/in-and-macro-not-working/m-p/512349#M137979</link>
      <description>&lt;P&gt;This works perfectly! Thank you SuryaKiran!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Nov 2018 21:14:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/in-and-macro-not-working/m-p/512349#M137979</guid>
      <dc:creator>saslove</dc:creator>
      <dc:date>2018-11-12T21:14:01Z</dc:date>
    </item>
  </channel>
</rss>

