<?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 Selective upcase in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Selective-upcase/m-p/209468#M38863</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'd appreciate some advice regarding selective upcase.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Consider the following string:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;"Some examples are Sas, Fbi, Cia, Fda, and Nsa."&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there a practical way of saying "when the string contains ('Sas', 'Fbi', 'Cia', etc.) then those should be upcase?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I can always treat each individual case using the case function w/multiple when-then, but I'd rather put everything that should be upcase within a set of paranthesis, as above. If possible... &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your time.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 05 May 2015 11:48:47 GMT</pubDate>
    <dc:creator>EinarRoed</dc:creator>
    <dc:date>2015-05-05T11:48:47Z</dc:date>
    <item>
      <title>Selective upcase</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Selective-upcase/m-p/209468#M38863</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'd appreciate some advice regarding selective upcase.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Consider the following string:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;"Some examples are Sas, Fbi, Cia, Fda, and Nsa."&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there a practical way of saying "when the string contains ('Sas', 'Fbi', 'Cia', etc.) then those should be upcase?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I can always treat each individual case using the case function w/multiple when-then, but I'd rather put everything that should be upcase within a set of paranthesis, as above. If possible... &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your time.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 05 May 2015 11:48:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Selective-upcase/m-p/209468#M38863</guid>
      <dc:creator>EinarRoed</dc:creator>
      <dc:date>2015-05-05T11:48:47Z</dc:date>
    </item>
    <item>
      <title>Re: Selective upcase</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Selective-upcase/m-p/209469#M38864</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Well, if you can put some logic rules on it then possibly.&amp;nbsp; For instance, will they always be three letters?&amp;nbsp; I doubt you can put logic on it though, as what your talking about is anachronisms which aren't part of a basic language formula, but a made up thing by companies or such like.&amp;nbsp; For instance, Sas, could relate to SAS Software, the SAS (military), Scandanavian Air Services etc. depending on context.&amp;nbsp; Cia could be a shortening of Cioa in Italian etc.&lt;/P&gt;&lt;P&gt;So without a logical rule, you would need to supply a list of them yourself.&amp;nbsp; Maybe create a dataset with the ones you know, and a decode.&amp;nbsp; Then you can update that separately from your code.&amp;nbsp; E.g.&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; create table WANT as&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; select&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; A.*,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (select LONG_VAL from CODELIST where SHORT_VAL=A.SHORT_VAL) as LONG_VAL&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; from&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; HAVE;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Dataset:&lt;/P&gt;&lt;P&gt;Short_Val&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Long_val&lt;/P&gt;&lt;P&gt;fbi&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FBI&lt;/P&gt;&lt;P&gt;sas&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SAS&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 05 May 2015 12:02:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Selective-upcase/m-p/209469#M38864</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2015-05-05T12:02:50Z</dc:date>
    </item>
    <item>
      <title>Re: Selective upcase</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Selective-upcase/m-p/209470#M38865</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;you can use proc format for this.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 05 May 2015 12:13:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Selective-upcase/m-p/209470#M38865</guid>
      <dc:creator>Steelers_In_DC</dc:creator>
      <dc:date>2015-05-05T12:13:03Z</dc:date>
    </item>
    <item>
      <title>Re: Selective upcase</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Selective-upcase/m-p/209471#M38866</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the feedback. Here's a little more background:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We have a list of bank names, and they're all in upcase. We need them in propcase. However, there's a few 'shared terms' that should always be upcase, such as for example 'ASA'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Basically I want to avoid writing this for each of those terms and banks:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;case&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; when 'Bank 1 Asa' then 'Bank 1 ASA'&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; when 'Bank 2 Asa' then 'Bank 2 ASA'&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; when 'Bank 3 Asa' then 'Bank 3 ASA'&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; when 'Bank 4 Asa' then 'Bank 4 ASA'&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;end&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;I could of course use tranwrd(bankname, 'Asa', 'ASA'), but is there a way to use it multiple times, for 5-6 different terms, within the same expression? In example 'As' should always be 'AS', and 'Sb' should always be 'SB' - and only as long as they're individual words, not part of other words ('Asatru Asa' should not become 'ASAtru ASA', but 'Asatru ASA', to use a random fictive example).&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 05 May 2015 12:18:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Selective-upcase/m-p/209471#M38866</guid>
      <dc:creator>EinarRoed</dc:creator>
      <dc:date>2015-05-05T12:18:20Z</dc:date>
    </item>
    <item>
      <title>Re: Selective upcase</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Selective-upcase/m-p/209472#M38867</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, though I don't use formats.&amp;nbsp; As mentioned, first step would be to create the dataset of the pairs, e.g.&lt;/P&gt;&lt;P&gt;VAL1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; VAL2&lt;/P&gt;&lt;P&gt;Bank 1 Asa&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Bank 1 ASA&lt;/P&gt;&lt;P&gt;Bank 2 Asa&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Bank 2 ASA&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then from that dataset you can do:&lt;/P&gt;&lt;P&gt;data _null_;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; set codelist end=last;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if _n_=1 then call execute('data want; set have;');&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; call execute('if myvalue="'||strip(val1)||'" then newvalue="'||strip(val2)||"';');&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if last then call execute('run;');&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note, you could alo do the above by merging as well.&amp;nbsp; Its really a case of knowing what to change, i.e. what logic rules, up front, rather than a method of coding it.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 05 May 2015 12:32:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Selective-upcase/m-p/209472#M38867</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2015-05-05T12:32:45Z</dc:date>
    </item>
  </channel>
</rss>

