<?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: Effective way to check if a macro variable takes values among several values in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Effective-way-to-check-if-a-macro-variable-takes-values-among/m-p/194425#M48802</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;You give the following a try:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;%LET X=d;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;%LET Y=a b c d e f g;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;%let M = %sysfunc(sign(%index(&amp;amp;y,&amp;amp;x)));&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;%put the value of M is &amp;gt;&amp;gt;&amp;gt; &amp;amp;M;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 04 Mar 2015 19:36:14 GMT</pubDate>
    <dc:creator>billfish</dc:creator>
    <dc:date>2015-03-04T19:36:14Z</dc:date>
    <item>
      <title>Effective way to check if a macro variable takes values among several values</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Effective-way-to-check-if-a-macro-variable-takes-values-among/m-p/194423#M48800</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am trying to create a macro variable &lt;STRONG&gt;M&lt;/STRONG&gt; that takes 1 if macro variable &lt;STRONG&gt;X&lt;/STRONG&gt; takes values among a set of values defined by another macro variable &lt;STRONG&gt;Y&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example, %LET X=a;&amp;nbsp; %LET Y=a b c d e f g;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Since a is one of values of Y, so macro variable M takes 1; otherwise, it takes 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can you please show me some quick way to write it? In STATA, it is something like &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Local M: list X in Y&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sunny&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Mar 2015 18:52:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Effective-way-to-check-if-a-macro-variable-takes-values-among/m-p/194423#M48800</guid>
      <dc:creator>Sunny_Sun</dc:creator>
      <dc:date>2015-03-04T18:52:26Z</dc:date>
    </item>
    <item>
      <title>Re: Effective way to check if a macro variable takes values among several values</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Effective-way-to-check-if-a-macro-variable-takes-values-among/m-p/194424#M48801</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This should be easy enough:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%if %index(%str( &amp;amp;y ), %str( &amp;amp;x )) %then %let m=1;&lt;/P&gt;&lt;P&gt;%else %let m=0;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It's important to keep the blanks inside the parentheses, before and after &amp;amp;x and &amp;amp;y.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Good luck.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Mar 2015 19:26:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Effective-way-to-check-if-a-macro-variable-takes-values-among/m-p/194424#M48801</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2015-03-04T19:26:34Z</dc:date>
    </item>
    <item>
      <title>Re: Effective way to check if a macro variable takes values among several values</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Effective-way-to-check-if-a-macro-variable-takes-values-among/m-p/194425#M48802</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;BR /&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;You give the following a try:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;%LET X=d;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;%LET Y=a b c d e f g;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;%let M = %sysfunc(sign(%index(&amp;amp;y,&amp;amp;x)));&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;%put the value of M is &amp;gt;&amp;gt;&amp;gt; &amp;amp;M;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Mar 2015 19:36:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Effective-way-to-check-if-a-macro-variable-takes-values-among/m-p/194425#M48802</guid>
      <dc:creator>billfish</dc:creator>
      <dc:date>2015-03-04T19:36:14Z</dc:date>
    </item>
    <item>
      <title>Re: Effective way to check if a macro variable takes values among several values</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Effective-way-to-check-if-a-macro-variable-takes-values-among/m-p/194426#M48803</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;many thanks it works. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Mar 2015 19:51:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Effective-way-to-check-if-a-macro-variable-takes-values-among/m-p/194426#M48803</guid>
      <dc:creator>Sunny_Sun</dc:creator>
      <dc:date>2015-03-04T19:51:37Z</dc:date>
    </item>
    <item>
      <title>Re: Effective way to check if a macro variable takes values among several values</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Effective-way-to-check-if-a-macro-variable-takes-values-among/m-p/194427#M48804</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;many thanks for your help&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Mar 2015 19:52:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Effective-way-to-check-if-a-macro-variable-takes-values-among/m-p/194427#M48804</guid>
      <dc:creator>Sunny_Sun</dc:creator>
      <dc:date>2015-03-04T19:52:47Z</dc:date>
    </item>
  </channel>
</rss>

