<?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: Format in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Format/m-p/501295#M133648</link>
    <description>&lt;P&gt;Wow.&lt;/P&gt;
&lt;P&gt;You seem to have serious misunderstandings about how programming works, and to badly need training.&lt;/P&gt;
&lt;P&gt;I&amp;nbsp;doubt the punctual help we can give here is going to take you very far.&lt;/P&gt;
&lt;P&gt;To answer the question at hand:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format;
  value $wood_desc 'WHITE'                       = 'Birch'
                   'BLACK'                       = 'Ebony'
                   'CHINESE','PAKISTANI','OTHER' = 'Oak'
                   'UNKNOWN','NOT APPLICABLE'    = 'Unknown';
run;
data WANT;
  A='   WHiTE';
  B=put(strip(compbl(upcase(A))), $wood_desc.);
  putlog B=;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;B=Birch&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;I had to change the data&amp;nbsp;as I find yours creepy.&lt;/P&gt;
&lt;P&gt;As a European, such data about race/religion/etc is forbidden in many countries as its use only a few decades ago brings back very&amp;nbsp;dark memories.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 03 Oct 2018 22:46:16 GMT</pubDate>
    <dc:creator>ChrisNZ</dc:creator>
    <dc:date>2018-10-03T22:46:16Z</dc:date>
    <item>
      <title>Format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Format/m-p/500928#M133479</link>
      <description>&lt;P&gt;Using SAS 9.4&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc format;&lt;BR /&gt;&lt;BR /&gt;value $RACE_DESC&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;'WHITE'&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; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; =&amp;nbsp; &amp;nbsp; 'Caucasian'&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; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 'BLACK'&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; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; =&amp;nbsp; &amp;nbsp;'African American'&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; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;'CHINESE','PAKISTANI','OTHER'&amp;nbsp; &amp;nbsp;=&amp;nbsp; &amp;nbsp;'Other'&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; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;'UNKNOWN','NOT APPLICABLE'&amp;nbsp; &amp;nbsp;=&amp;nbsp; &amp;nbsp;'Unknown';&lt;BR /&gt;RUN;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Above is format statement. I believe it is formatted correctly. Is their a way to trim the 'white' 'black' etc. to remove any weird spaces that I am not capturing in my format. (I did try copy and pasting directly from document and it did not work that way either). Thank you&lt;/P&gt;</description>
      <pubDate>Tue, 02 Oct 2018 19:47:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Format/m-p/500928#M133479</guid>
      <dc:creator>GS2</dc:creator>
      <dc:date>2018-10-02T19:47:26Z</dc:date>
    </item>
    <item>
      <title>Re: Format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Format/m-p/500942#M133483</link>
      <description>&lt;P&gt;trim(race_desc) in the data step?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 02 Oct 2018 20:07:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Format/m-p/500942#M133483</guid>
      <dc:creator>HB</dc:creator>
      <dc:date>2018-10-02T20:07:58Z</dc:date>
    </item>
    <item>
      <title>Re: Format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Format/m-p/500966#M133494</link>
      <description>&lt;P&gt;&lt;FONT face="courier new,courier"&gt;strip()&lt;/FONT&gt; to remove leading and trailing spaces&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;compbl()&lt;/FONT&gt; to remove extraneous inner spaces&lt;/P&gt;
&lt;P&gt;You might want to &lt;FONT face="courier new,courier"&gt;upcase()&lt;/FONT&gt; too,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 02 Oct 2018 21:03:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Format/m-p/500966#M133494</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2018-10-02T21:03:25Z</dc:date>
    </item>
    <item>
      <title>Re: Format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Format/m-p/500994#M133511</link>
      <description>&lt;P&gt;No. But if you switch to using an INFORMAT instead of a FORMAT then you can use REGEXP or REGEXPE option of the INVALUE statement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://documentation.sas.com/?docsetId=proc&amp;amp;docsetVersion=9.4&amp;amp;docsetTarget=p1pmw90bl3jzgdn1w4202kclxtho.htm&amp;amp;locale=en" target="_blank"&gt;https://documentation.sas.com/?docsetId=proc&amp;amp;docsetVersion=9.4&amp;amp;docsetTarget=p1pmw90bl3jzgdn1w4202kclxtho.htm&amp;amp;locale=en&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 02 Oct 2018 23:49:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Format/m-p/500994#M133511</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2018-10-02T23:49:00Z</dc:date>
    </item>
    <item>
      <title>Re: Format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Format/m-p/501116#M133576</link>
      <description>&lt;P&gt;data raw.DiagSeq_1_2;&lt;BR /&gt;set raw.DiagSeq_One;&lt;BR /&gt;if RACE = (STRIP('WHITE') OR&lt;BR /&gt;RACE = (STRIP('BLACK') OR&lt;BR /&gt;RACE = (STRIP('CHINESE') OR&lt;BR /&gt;RACE = (STRIP('PAKISTANI') OR&lt;BR /&gt;RACE = (STRIP('OTHER') OR&lt;BR /&gt;RACE = (STRIP('UNKNOWN') OR&lt;BR /&gt;RACE = (STRIP('NOT APPLICABLE');&lt;BR /&gt;RUN;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Above is the code I tried, it is a combination of the recommendations but it is not working. Any other thoughts?&lt;/P&gt;</description>
      <pubDate>Wed, 03 Oct 2018 12:56:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Format/m-p/501116#M133576</guid>
      <dc:creator>GS2</dc:creator>
      <dc:date>2018-10-03T12:56:35Z</dc:date>
    </item>
    <item>
      <title>Re: Format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Format/m-p/501295#M133648</link>
      <description>&lt;P&gt;Wow.&lt;/P&gt;
&lt;P&gt;You seem to have serious misunderstandings about how programming works, and to badly need training.&lt;/P&gt;
&lt;P&gt;I&amp;nbsp;doubt the punctual help we can give here is going to take you very far.&lt;/P&gt;
&lt;P&gt;To answer the question at hand:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format;
  value $wood_desc 'WHITE'                       = 'Birch'
                   'BLACK'                       = 'Ebony'
                   'CHINESE','PAKISTANI','OTHER' = 'Oak'
                   'UNKNOWN','NOT APPLICABLE'    = 'Unknown';
run;
data WANT;
  A='   WHiTE';
  B=put(strip(compbl(upcase(A))), $wood_desc.);
  putlog B=;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;B=Birch&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;I had to change the data&amp;nbsp;as I find yours creepy.&lt;/P&gt;
&lt;P&gt;As a European, such data about race/religion/etc is forbidden in many countries as its use only a few decades ago brings back very&amp;nbsp;dark memories.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 03 Oct 2018 22:46:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Format/m-p/501295#M133648</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2018-10-03T22:46:16Z</dc:date>
    </item>
  </channel>
</rss>

