<?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 center data in a column and align decimals in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-center-data-in-a-column-and-align-decimals/m-p/59196#M256365</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;A workaround is padding a character (i.e. 0) after decimal , and make it color as white.&lt;/P&gt;&lt;P&gt;Assuming there are only two digits after decimal.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt; 
data class;
&amp;nbsp; set sashelp.class;
&amp;nbsp; height = height+.8;
&amp;nbsp; weight = weight+.9;
&amp;nbsp; if name in('Alfred' 'Carol' 'James')
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; then do;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; height = 88.88;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; weight =77.77;
&amp;nbsp; end;
 length char_weight $ 80;
 if mod(weight*10,1)=0 then char_weight=put(weight,best6.2)||'~S={foreground=white}0';
&amp;nbsp; else char_weight=put(weight,best6.2 );
run;
&amp;nbsp;&amp;nbsp; 
ods listing close;
title; footnote;
ods escapechar='~';
ods rtf file='c:\temp\just_d.rtf' style=journal;
&amp;nbsp; 
proc report data=class nowd;
&amp;nbsp; column name age height weight char_weight;
&amp;nbsp; define height / 'ht Just=c'
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; style(column)={just=c};
&amp;nbsp; define weight / 'wt just=d'
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; style(column)={just=d};
&amp;nbsp; define char_weight / 'wt just=c with padding 0'
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; style(column)={just=c width=2in asis=on};
run;
ods rtf close;
ods listing;

&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Xia Keshan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 28 Jan 2015 08:42:21 GMT</pubDate>
    <dc:creator>Ksharp</dc:creator>
    <dc:date>2015-01-28T08:42:21Z</dc:date>
    <item>
      <title>How to center data in a column and align decimals</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-center-data-in-a-column-and-align-decimals/m-p/59190#M256359</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm trying to figure out how to center data in a column in proc report for ods pdf output and have the decimal points aligned.&amp;nbsp; I've been using just=d to align on decimals (which justifies to the right) but can't figure out how to also center the values.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is what I'm getting:&lt;/P&gt;&lt;P&gt;Header&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 17.5&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 5.2&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is what I'm looking for:&lt;/P&gt;&lt;P&gt;Header&lt;/P&gt;&lt;P&gt;&amp;nbsp; 17.5&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 5.2&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any ideas?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 Apr 2012 23:48:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-center-data-in-a-column-and-align-decimals/m-p/59190#M256359</guid>
      <dc:creator>kmorrowvt</dc:creator>
      <dc:date>2012-04-09T23:48:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to center data in a column and align decimals</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-center-data-in-a-column-and-align-decimals/m-p/59191#M256360</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Is this helpful?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc template;&lt;/P&gt;&lt;P&gt; define style styles.center;&lt;/P&gt;&lt;P&gt;&amp;nbsp; parent=styles.printer;&lt;/P&gt;&lt;P&gt;&amp;nbsp; /* Control PROC PRINT's headers&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; */&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; style header from header /&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; cellwidth=1in&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="color: #ff0000;"&gt; just=c&lt;/SPAN&gt;;&lt;/P&gt;&lt;P&gt;&amp;nbsp; /* Control PROC PRINT's data values */&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; style data from data / &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="color: #ff0000;"&gt; just=d;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; /* Control the OBS column&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; */&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; style rowheader from header /&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; cellwidth=1in&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; just=c;&lt;/P&gt;&lt;P&gt; end;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Apr 2012 00:08:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-center-data-in-a-column-and-align-decimals/m-p/59191#M256360</guid>
      <dc:creator>Linlin</dc:creator>
      <dc:date>2012-04-10T00:08:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to center data in a column and align decimals</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-center-data-in-a-column-and-align-decimals/m-p/59192#M256361</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This doesn't seem to center the data.&amp;nbsp; The output is the same was using simply just=d.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Apr 2012 13:03:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-center-data-in-a-column-and-align-decimals/m-p/59192#M256361</guid>
      <dc:creator>kmorrowvt</dc:creator>
      <dc:date>2012-04-10T13:03:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to center data in a column and align decimals</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-center-data-in-a-column-and-align-decimals/m-p/59193#M256362</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi:&lt;/P&gt;&lt;P&gt;&amp;nbsp; Inside PROC REPORT, you can also use JUST=C and JUST=D -- but no matter whether you're using PROC PRINT, PROC REPORT, PROC TABULATE or a custom TABLE template -- you can only have 1 justification value for your cells. 1cell=1justification&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; But, if you look at the attached screenshot (red lines are my highlight), what you can do is approximate JUST=D and centered by fiddling with the right margin of the cell. You won't be able to have a "one size fits all" solution, because the width= and rightmargin= value may need to change for different data or even different fonts or font sizes, but this gets you closer to what you want. You might also play around with cellpadding to see whether that might look better. But cellpadding increases ALL the white space around your font characters whereas right margin just leaves white space on the right side of the cell/column.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;cynthia&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;data class;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;&amp;nbsp; set sashelp.class;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;&amp;nbsp; height = height+.8;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;&amp;nbsp; weight = weight+.9;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;&amp;nbsp; if name in('Alfred' 'Carol' 'James')&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; then do;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; height = 88.88;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; weight =77.77;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;&amp;nbsp; end;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;run;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;ods listing close;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;title; footnote;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;ods pdf file='c:\temp\just_d.pdf';&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;proc report data=class nowd;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;&amp;nbsp; column name age height weight weight=wt2;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;&amp;nbsp; define height / 'ht Just=c'&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; style(column)={just=c};&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;&amp;nbsp; define weight / 'wt just=d'&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; style(column)={just=d};&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;&amp;nbsp; define wt2 / 'wt just=d/chg margin'&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; style(column)={just=d width=1.0in rightmargin=.25in};&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;run;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;ods _all_ close;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/11278i57C62D42CD2A7863/image-size/large?v=1.0&amp;amp;px=600" border="0" alt="just_d_and_changed_margin.jpg" title="just_d_and_changed_margin.jpg" /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Apr 2012 14:02:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-center-data-in-a-column-and-align-decimals/m-p/59193#M256362</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2012-04-10T14:02:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to center data in a column and align decimals</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-center-data-in-a-column-and-align-decimals/m-p/59194#M256363</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This is great, thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Apr 2012 14:30:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-center-data-in-a-column-and-align-decimals/m-p/59194#M256363</guid>
      <dc:creator>kmorrowvt</dc:creator>
      <dc:date>2012-04-10T14:30:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to center data in a column and align decimals</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-center-data-in-a-column-and-align-decimals/m-p/59195#M256364</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey Cynthia, is there a similar work around for RTF, as the above code didn't work in RTF. Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Jan 2015 21:57:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-center-data-in-a-column-and-align-decimals/m-p/59195#M256364</guid>
      <dc:creator>HTFlyer</dc:creator>
      <dc:date>2015-01-27T21:57:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to center data in a column and align decimals</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-center-data-in-a-column-and-align-decimals/m-p/59196#M256365</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;A workaround is padding a character (i.e. 0) after decimal , and make it color as white.&lt;/P&gt;&lt;P&gt;Assuming there are only two digits after decimal.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt; 
data class;
&amp;nbsp; set sashelp.class;
&amp;nbsp; height = height+.8;
&amp;nbsp; weight = weight+.9;
&amp;nbsp; if name in('Alfred' 'Carol' 'James')
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; then do;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; height = 88.88;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; weight =77.77;
&amp;nbsp; end;
 length char_weight $ 80;
 if mod(weight*10,1)=0 then char_weight=put(weight,best6.2)||'~S={foreground=white}0';
&amp;nbsp; else char_weight=put(weight,best6.2 );
run;
&amp;nbsp;&amp;nbsp; 
ods listing close;
title; footnote;
ods escapechar='~';
ods rtf file='c:\temp\just_d.rtf' style=journal;
&amp;nbsp; 
proc report data=class nowd;
&amp;nbsp; column name age height weight char_weight;
&amp;nbsp; define height / 'ht Just=c'
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; style(column)={just=c};
&amp;nbsp; define weight / 'wt just=d'
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; style(column)={just=d};
&amp;nbsp; define char_weight / 'wt just=c with padding 0'
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; style(column)={just=c width=2in asis=on};
run;
ods rtf close;
ods listing;

&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Xia Keshan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Jan 2015 08:42:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-center-data-in-a-column-and-align-decimals/m-p/59196#M256365</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2015-01-28T08:42:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to center data in a column and align decimals</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-center-data-in-a-column-and-align-decimals/m-p/545341#M256366</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13549"&gt;@Cynthia_sas&lt;/a&gt;&amp;nbsp; What’s the best way to align percents/parenthesis if your data is character in the form, nn (pp.p%) or nn (pp)?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I started a new thread here,&amp;nbsp;&lt;A href="https://communities.sas.com/t5/ODS-and-Base-Reporting/ODS-TAGSETS-RTF-RTF-How-does-Decimal-Alignment-work-style-column/m-p/545321" target="_blank" rel="noopener"&gt;https://communities.sas.com/t5/ODS-and-Base-Reporting/ODS-TAGSETS-RTF-RTF-How-does-Decimal-Alignment-work-style-column/m-p/545321&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I can’t seem to get just=d working how I’d like it to. &amp;nbsp;Particularly for proportional font like times new roman.&lt;/P&gt;</description>
      <pubDate>Fri, 22 Mar 2019 18:27:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-center-data-in-a-column-and-align-decimals/m-p/545341#M256366</guid>
      <dc:creator>SmithCJGVSU</dc:creator>
      <dc:date>2019-03-22T18:27:02Z</dc:date>
    </item>
  </channel>
</rss>

