<?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 SAS Tip: Aligning with a Put Function in SAS Tips from the Community</title>
    <link>https://communities.sas.com/t5/SAS-Tips-from-the-Community/SAS-Tip-Aligning-with-a-Put-Function/m-p/475991#M184</link>
    <description>&lt;P&gt;While we often use&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;SAS&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;functions&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;LEFT and RIGHT to align character values, we can also achieve the same item with the use of PUT function.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In the PUT function section in the SAS documentation, there is a specific section on this. See an example at right.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;NOTE&lt;/STRONG&gt;: The&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;CODE&gt;-l&lt;/CODE&gt;,&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;CODE&gt;-c&lt;/CODE&gt;, and&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;CODE&gt;-r&lt;/CODE&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;format modifiers can also be used in PUT&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;statements&lt;/STRONG&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data temp;
 
alphabetw='  a  ';
chardate=put(alphabetw,$10. -l);
output ;
chardate=put(alphabetw,$10. -c);
output ;
chardate=put(alphabetw,$10. -r);
output ;
 
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc print;run;
 
Obs    alphabetw  chardate
 
 1        a       a
 2        a           a
 3        a                a&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;EM&gt;This tip was originally posted by Murphy Choy on sasCommunity.org.&amp;nbsp;&lt;/EM&gt;&lt;/P&gt;
&lt;DIV class="mw-geshi mw-code mw-content-ltr" dir="ltr"&gt;&amp;nbsp;&lt;/DIV&gt;</description>
    <pubDate>Fri, 06 Jul 2018 13:31:41 GMT</pubDate>
    <dc:creator>SAS_Tipster</dc:creator>
    <dc:date>2018-07-06T13:31:41Z</dc:date>
    <item>
      <title>SAS Tip: Aligning with a Put Function</title>
      <link>https://communities.sas.com/t5/SAS-Tips-from-the-Community/SAS-Tip-Aligning-with-a-Put-Function/m-p/475991#M184</link>
      <description>&lt;P&gt;While we often use&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;SAS&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;functions&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;LEFT and RIGHT to align character values, we can also achieve the same item with the use of PUT function.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In the PUT function section in the SAS documentation, there is a specific section on this. See an example at right.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;NOTE&lt;/STRONG&gt;: The&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;CODE&gt;-l&lt;/CODE&gt;,&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;CODE&gt;-c&lt;/CODE&gt;, and&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;CODE&gt;-r&lt;/CODE&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;format modifiers can also be used in PUT&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;statements&lt;/STRONG&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data temp;
 
alphabetw='  a  ';
chardate=put(alphabetw,$10. -l);
output ;
chardate=put(alphabetw,$10. -c);
output ;
chardate=put(alphabetw,$10. -r);
output ;
 
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc print;run;
 
Obs    alphabetw  chardate
 
 1        a       a
 2        a           a
 3        a                a&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;EM&gt;This tip was originally posted by Murphy Choy on sasCommunity.org.&amp;nbsp;&lt;/EM&gt;&lt;/P&gt;
&lt;DIV class="mw-geshi mw-code mw-content-ltr" dir="ltr"&gt;&amp;nbsp;&lt;/DIV&gt;</description>
      <pubDate>Fri, 06 Jul 2018 13:31:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Tips-from-the-Community/SAS-Tip-Aligning-with-a-Put-Function/m-p/475991#M184</guid>
      <dc:creator>SAS_Tipster</dc:creator>
      <dc:date>2018-07-06T13:31:41Z</dc:date>
    </item>
  </channel>
</rss>

