<?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: Making a Macro Case Insensitive - Why do I have to use a macro variable? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Making-a-Macro-Case-Insensitive-Why-do-I-have-to-use-a-macro/m-p/744350#M233197</link>
    <description>&lt;P&gt;&amp;gt;&amp;nbsp;&lt;SPAN&gt;Why would&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;%let type = upcase(Type) be wrong?&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;It's not wrong.&amp;nbsp; The macro variable TYPE simply contains letters and parentheses.&lt;/P&gt;</description>
    <pubDate>Fri, 28 May 2021 09:49:28 GMT</pubDate>
    <dc:creator>ChrisNZ</dc:creator>
    <dc:date>2021-05-28T09:49:28Z</dc:date>
    <item>
      <title>Making a Macro Case Insensitive - Why do I have to use a macro variable?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Making-a-Macro-Case-Insensitive-Why-do-I-have-to-use-a-macro/m-p/744345#M233195</link>
      <description>&lt;P&gt;I want to make a Macro case in-sensitive so that if the user for instance writes Type or TYpE in the positional argument (see code below) it does not matter. My code is:&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro Customers(Type); 
	%let Type = %sysfunc(upcase(&amp;amp;Type)); &lt;STRONG&gt;*why is Type = upcase(Type) wrong? I.e. why do I have to create a macro variable?;&lt;/STRONG&gt;

	title "&amp;amp;type Customers"; 
	proc sql number;
	select Name, Age_Group, Type
	    from mc1.customers 
	    where upcase(Type) contains "&amp;amp;Type"; 
	quit; 
	title;
%mend Customers; &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Why would &lt;STRONG&gt;Type = upcase(Type) be wrong?&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/STRONG&gt;So the question is, why do I have to create a macro variable for the positional argument in this case?&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 28 May 2021 08:56:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Making-a-Macro-Case-Insensitive-Why-do-I-have-to-use-a-macro/m-p/744345#M233195</guid>
      <dc:creator>SasStatistics</dc:creator>
      <dc:date>2021-05-28T08:56:50Z</dc:date>
    </item>
    <item>
      <title>Re: Making a Macro Case Insensitive - Why do I have to use a macro variable?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Making-a-Macro-Case-Insensitive-Why-do-I-have-to-use-a-macro/m-p/744346#M233196</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/381436"&gt;@SasStatistics&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Macro parameters are local macro variables. You cannot use the DATA step syntax &lt;FONT face="courier new,courier"&gt;&lt;EM&gt;varname&lt;/EM&gt;=&lt;EM&gt;value&lt;/EM&gt;&lt;/FONT&gt;&amp;nbsp;of an assignment statement for macro variables. The %LET statement in your macro does not create a new macro variable, it changes the value of the &lt;EM&gt;existing&lt;/EM&gt; macro variable &lt;FONT face="courier new,courier"&gt;Type&lt;/FONT&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But you can simplify the correct %LET statement by using the &lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/mcrolref/p0t39yb3elv64zn1wpc804ilqwv4.htm" target="_blank" rel="noopener"&gt;%UPCASE macro function&lt;/A&gt;:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let Type = %upcase(&amp;amp;Type);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would be a bit concerned about your WHERE condition using the CONTAINS operator because, for example, it would also select &lt;EM&gt;IN&lt;/EM&gt;ACTIVE customers when you actually want ACTIVE customers.&lt;/P&gt;</description>
      <pubDate>Fri, 28 May 2021 09:27:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Making-a-Macro-Case-Insensitive-Why-do-I-have-to-use-a-macro/m-p/744346#M233196</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2021-05-28T09:27:41Z</dc:date>
    </item>
    <item>
      <title>Re: Making a Macro Case Insensitive - Why do I have to use a macro variable?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Making-a-Macro-Case-Insensitive-Why-do-I-have-to-use-a-macro/m-p/744350#M233197</link>
      <description>&lt;P&gt;&amp;gt;&amp;nbsp;&lt;SPAN&gt;Why would&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;%let type = upcase(Type) be wrong?&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;It's not wrong.&amp;nbsp; The macro variable TYPE simply contains letters and parentheses.&lt;/P&gt;</description>
      <pubDate>Fri, 28 May 2021 09:49:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Making-a-Macro-Case-Insensitive-Why-do-I-have-to-use-a-macro/m-p/744350#M233197</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2021-05-28T09:49:28Z</dc:date>
    </item>
  </channel>
</rss>

