<?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: Formatting decimal points after using Cat function in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Formatting-decimal-points-after-using-Cat-function/m-p/449489#M113123</link>
    <description>&lt;P&gt;The -L left justifies the result. if your value were actually 9.33 without the -L there would be a leading space as the F5.2 format will display the result in 5 columns and right justified by default: " 9.33"&amp;nbsp;. Since it appeared that you did not want the CI to look like ( 9.33-12.75) for example I used that option.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Character formats will default to left justification but if you want right justification when using Put with a character format you could use put(somevar,$charfmt. -R) which may appear better for some table row headers or graph axis values.&lt;/P&gt;</description>
    <pubDate>Wed, 28 Mar 2018 20:19:01 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2018-03-28T20:19:01Z</dc:date>
    <item>
      <title>Formatting decimal points after using Cat function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Formatting-decimal-points-after-using-Cat-function/m-p/449397#M113083</link>
      <description>&lt;P&gt;Hi everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a mean, lower CI variable and upper CI variable. I would like the combine them into one variable. The issue is the CI variable has a long decimal trail. I would like to limit it to two decimals after using the Cat function. So here is my code currently:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input Mean  :  lowerCLmean : upperCLmean;
cards;
45               30.123456                         50.789123
20               15.789123                         30.123456

;

data want;
set have;
new=cat(mean,' (',lowerclmean,'-',upperclmean,')');

proc print;run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;What I really want:&lt;/DIV&gt;&lt;DIV&gt;&lt;BR /&gt;Obs Mean lowerCLmean upperCLmean Really Want &lt;TABLE cellspacing="0" cellpadding="0"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;20&lt;/TD&gt;&lt;TD&gt;15.7891&lt;/TD&gt;&lt;TD&gt;30.1235&lt;/TD&gt;&lt;TD&gt;20 (&lt;STRONG&gt;15.78-30.12&lt;/STRONG&gt;)&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Mar 2018 15:22:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Formatting-decimal-points-after-using-Cat-function/m-p/449397#M113083</guid>
      <dc:creator>hwangnyc</dc:creator>
      <dc:date>2018-03-28T15:22:52Z</dc:date>
    </item>
    <item>
      <title>Re: Formatting decimal points after using Cat function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Formatting-decimal-points-after-using-Cat-function/m-p/449398#M113084</link>
      <description>&lt;P&gt;&lt;SPAN class="token procnames"&gt;data&lt;/SPAN&gt; want&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="token keyword"&gt;set&lt;/SPAN&gt; have&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;new&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;cat&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;mean&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt;&lt;SPAN class="token string"&gt;' ('&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;,put(&lt;/SPAN&gt;lowerclmean,f5.2 -L)&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt;&lt;SPAN class="token string"&gt;'-'&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;,put(&lt;/SPAN&gt;upperclmean,F5.2 -L)&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt;&lt;SPAN class="token string"&gt;')'&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="token punctuation"&gt;You can nest all sorts of functions inside the cat, cats, catt, catx etc. functions as long as the results are strings.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Mar 2018 15:26:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Formatting-decimal-points-after-using-Cat-function/m-p/449398#M113084</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-03-28T15:26:46Z</dc:date>
    </item>
    <item>
      <title>Re: Formatting decimal points after using Cat function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Formatting-decimal-points-after-using-Cat-function/m-p/449438#M113099</link>
      <description>&lt;P&gt;Thank you Ballard!&amp;nbsp;Can you tell me what the&amp;nbsp;&amp;nbsp;"-L" does?&lt;/P&gt;</description>
      <pubDate>Wed, 28 Mar 2018 17:42:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Formatting-decimal-points-after-using-Cat-function/m-p/449438#M113099</guid>
      <dc:creator>hwangnyc</dc:creator>
      <dc:date>2018-03-28T17:42:30Z</dc:date>
    </item>
    <item>
      <title>Re: Formatting decimal points after using Cat function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Formatting-decimal-points-after-using-Cat-function/m-p/449489#M113123</link>
      <description>&lt;P&gt;The -L left justifies the result. if your value were actually 9.33 without the -L there would be a leading space as the F5.2 format will display the result in 5 columns and right justified by default: " 9.33"&amp;nbsp;. Since it appeared that you did not want the CI to look like ( 9.33-12.75) for example I used that option.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Character formats will default to left justification but if you want right justification when using Put with a character format you could use put(somevar,$charfmt. -R) which may appear better for some table row headers or graph axis values.&lt;/P&gt;</description>
      <pubDate>Wed, 28 Mar 2018 20:19:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Formatting-decimal-points-after-using-Cat-function/m-p/449489#M113123</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-03-28T20:19:01Z</dc:date>
    </item>
  </channel>
</rss>

