<?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: How to use upcase and test upcase in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-upcase-and-test-upcase/m-p/720726#M223286</link>
    <description>&lt;P&gt;These are literals, so you do not need a function, just write them in uppercase:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt; if GEOGN in ("AUSTRALIA","AUSTRIA")&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;And you have to use the list immediately following the IN operator; also, the items in the list MUST be literals (constants).&lt;/P&gt;</description>
    <pubDate>Sun, 21 Feb 2021 11:35:40 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2021-02-21T11:35:40Z</dc:date>
    <item>
      <title>How to use upcase and test upcase</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-upcase-and-test-upcase/m-p/720725#M223285</link>
      <description>&lt;P&gt;Hi all SAS Users,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have want to create a variable &lt;CODE class=" language-sas"&gt;voi_and_acc=1&lt;/CODE&gt; if&amp;nbsp; GEOGN match one of some specific words&lt;/P&gt;
&lt;P&gt;For example, I have some input specific words like: Argentina, AuStralia&lt;/P&gt;
&lt;P&gt;GEOGN is ARGENTINA and AUSTRALIA.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So, I guess my code should be&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data add_sub;
	set work.merge_treat_con;
	 if GEOGN in upcase("Australia","Austria") then voi_and_acc=1;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However, the error showing is that&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;28         data add_sub;
29         	set work.merge_treat_con;
30         	 if GEOGN in upcase("Australia","Austria") then voi_and_acc=1;
                               _
                               22
                               76
ERROR: The right-hand operand must be an array name or a constant value list.  The specified name upcase, is not an array.
ERROR 22-322: Syntax error, expecting one of the following: IN, NOTIN.  

ERROR 76-322: Syntax error, statement will be ignored.&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Could you please help me to sort it out?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Many thanks.&lt;/P&gt;</description>
      <pubDate>Sun, 21 Feb 2021 11:27:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-upcase-and-test-upcase/m-p/720725#M223285</guid>
      <dc:creator>Phil_NZ</dc:creator>
      <dc:date>2021-02-21T11:27:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to use upcase and test upcase</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-upcase-and-test-upcase/m-p/720726#M223286</link>
      <description>&lt;P&gt;These are literals, so you do not need a function, just write them in uppercase:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt; if GEOGN in ("AUSTRALIA","AUSTRIA")&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;And you have to use the list immediately following the IN operator; also, the items in the list MUST be literals (constants).&lt;/P&gt;</description>
      <pubDate>Sun, 21 Feb 2021 11:35:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-upcase-and-test-upcase/m-p/720726#M223286</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-02-21T11:35:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to use upcase and test upcase</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-upcase-and-test-upcase/m-p/720729#M223288</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/212695"&gt;@Phil_NZ&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi all SAS Users,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have want to create a variable &lt;CODE class=" language-sas"&gt;voi_and_acc=1&lt;/CODE&gt; if&amp;nbsp; GEOGN match one of some specific words&lt;/P&gt;
&lt;P&gt;For example, I have some input specific words like: Argentina, AuStralia&lt;/P&gt;
&lt;P&gt;GEOGN is ARGENTINA and AUSTRALIA.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So, I guess my code should be&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data add_sub;
	set work.merge_treat_con;
	 if GEOGN in upcase("Australia","Austria") then voi_and_acc=1;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;You could also use the FIND function, which allows case insensitive testing of character strings using the &lt;FONT face="courier new,courier"&gt;'i'&lt;/FONT&gt; option.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if find(geogn,'Australia','i')&amp;gt;0 or find(geogn,'Austria','i')&amp;gt;0 then ...&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Adding on to &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt; 's answer, most SAS interfaces have keyboard shortcuts that allow you to change text that you have selected and convert it to uppercase, magically, right before your eyes! On my Windows 10 computer running Base SAS 9.4, the keyboard shortcut is Ctrl-Shift-U. So if you typed mixed case "Australia" and then select it and Ctrl-Shift-U, now you have "AUSTRALIA". &lt;/P&gt;</description>
      <pubDate>Sun, 21 Feb 2021 12:44:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-upcase-and-test-upcase/m-p/720729#M223288</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-02-21T12:44:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to use upcase and test upcase</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-upcase-and-test-upcase/m-p/720779#M223305</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;PRE&gt;And you have to use the list immediately following the IN operator&lt;CODE class=" language-sas"&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Does it mean that I cannot use&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;if GEOGN in upcase()&lt;/STRONG&gt; or any function but just only&amp;nbsp;&lt;STRONG&gt;if GEOGN in()&lt;/STRONG&gt; ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Warm regards.&lt;/P&gt;</description>
      <pubDate>Sun, 21 Feb 2021 21:02:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-upcase-and-test-upcase/m-p/720779#M223305</guid>
      <dc:creator>Phil_NZ</dc:creator>
      <dc:date>2021-02-21T21:02:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to use upcase and test upcase</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-upcase-and-test-upcase/m-p/720780#M223306</link>
      <description>&lt;P&gt;You can do this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if geogn in (upcase('Australia'))&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;but it would be less typing to do this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if geogn in ('AUSTRALIA')&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 21 Feb 2021 21:34:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-upcase-and-test-upcase/m-p/720780#M223306</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-02-21T21:34:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to use upcase and test upcase</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-upcase-and-test-upcase/m-p/720781#M223307</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/212695"&gt;@Phil_NZ&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;PRE&gt;And you have to use the list immediately following the IN operator&lt;CODE class=" language-sas"&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Does it mean that I cannot use&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;if GEOGN in upcase()&lt;/STRONG&gt; or any function but just only&amp;nbsp;&lt;STRONG&gt;if GEOGN in()&lt;/STRONG&gt; ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Warm regards.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Absolutely. See the documentation of the&amp;nbsp;&lt;A href="https://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.4&amp;amp;docsetId=lepg&amp;amp;docsetTarget=p1n8bsqqd03xppn17pgvjpjlbhhs.htm&amp;amp;locale=en#n1qev6umhhr2xbn1ky0c8bc8sna7" target="_blank" rel="noopener"&gt;IN Operator&lt;/A&gt;.&lt;BR /&gt;The IN is set up by the data step or SQL compiler at compile time, so it cannot have variable expressions or functions in it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 21 Feb 2021 21:36:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-upcase-and-test-upcase/m-p/720781#M223307</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-02-21T21:36:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to use upcase and test upcase</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-upcase-and-test-upcase/m-p/720785#M223310</link>
      <description>&lt;P&gt;The syntax I'd use would be:&lt;/P&gt;
&lt;LI-CODE lang="sas"&gt;if GEOGN in %upcase(('Australia','Austria')) &lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;This ensures the interpreted string is static, for better performance.&lt;/P&gt;</description>
      <pubDate>Sun, 21 Feb 2021 21:51:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-upcase-and-test-upcase/m-p/720785#M223310</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2021-02-21T21:51:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to use upcase and test upcase</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-upcase-and-test-upcase/m-p/720786#M223311</link>
      <description>&lt;P&gt;Another option is:&lt;/P&gt;
&lt;LI-CODE lang="sas"&gt;if prxmatch('/Australia|Austria/i',GEOGN) &lt;/LI-CODE&gt;
&lt;P&gt;The list of words can easily be expanded, and the final &lt;FONT face="courier new,courier"&gt;i&lt;/FONT&gt; make the match case-insensitive.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 21 Feb 2021 21:54:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-upcase-and-test-upcase/m-p/720786#M223311</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2021-02-21T21:54:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to use upcase and test upcase</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-upcase-and-test-upcase/m-p/720788#M223312</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/16961"&gt;@ChrisNZ&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;The syntax I'd use would be:&lt;/P&gt;
&lt;LI-CODE lang="sas"&gt;if GEOGN in %upcase(('Australia','Austria')) &lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;This ensures the interpreted string is static, for better performance.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;It's still less typing to put the country names in uppercase to begin with.&lt;/P&gt;</description>
      <pubDate>Sun, 21 Feb 2021 21:57:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-upcase-and-test-upcase/m-p/720788#M223312</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-02-21T21:57:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to use upcase and test upcase</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-upcase-and-test-upcase/m-p/720806#M223317</link>
      <description>&lt;P&gt;I understand the words come as is.&amp;nbsp; &amp;nbsp;&lt;EM&gt;&amp;nbsp;GEOGN match one of some specific words&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Yes these words could be uppercased&amp;nbsp;too if that doesn't have any negative effect somewhere else&lt;/P&gt;</description>
      <pubDate>Mon, 22 Feb 2021 03:16:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-upcase-and-test-upcase/m-p/720806#M223317</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2021-02-22T03:16:20Z</dc:date>
    </item>
  </channel>
</rss>

