<?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 retain various formats in common variables after combining datasets in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/retain-various-formats-in-common-variables-after-combining/m-p/584027#M14082</link>
    <description>&lt;P&gt;The yr variable with a range of 2005-2016 becomes separate variables when the data are transformed.&amp;nbsp; The variable stat has three values, "Deaths," "CMR", and "AAMR" which I format with 0, 1, and 2 decimal places, respectively. They appear that way in the datasets death2, cmr2, and aamr2 columns &lt;FONT color="#800080" face="Courier New" size="3"&gt;'2005'N&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;-&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'2016'N&lt;/FONT&gt; .&amp;nbsp; When I combine the datasets, the &lt;FONT color="#800080" face="Courier New" size="3"&gt;'2005'N&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;-&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'2016'N&lt;/FONT&gt; columns are all formatted to 1 decimal place, instead of 0, 1, and 2 places that I want.&amp;nbsp; The original data have 0 decimals for dths, 8 decimals for CMR and 8 decimals for AAMR.&amp;nbsp; If I comment out the format lines below, the combined dataset has 0, 8, and 8 decimals in the &lt;FONT color="#800080" face="Courier New" size="3"&gt;'2005'N&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;-&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'2016'N&lt;/FONT&gt;&amp;nbsp;columns, demonstrating that they do not have to take the same format.&amp;nbsp; Adding to my perplexity is that my program seemed to work yesterday as intended.&amp;nbsp; I have tried closing and reopening SAS 9.4&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&lt;/FONT&gt; &lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;sort&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;data&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=AAMRtabout; &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;by&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; dthrank CODnum2 sex2; &lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;run&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;proc&lt;/FONT&gt;&lt;/STRONG&gt; &lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;transpose&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;data&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=AAMRtabout &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;out&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=dths_t (&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;drop&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=_NAME_);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;by&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; dthrank CODnum2 sex2;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;id&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; yr;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;var&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; dths_sum;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;run&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;data&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt; death2;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;set&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; dths_t;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;stat=&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;"Deaths"&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;run&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;proc&lt;/FONT&gt;&lt;/STRONG&gt; &lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;transpose&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;data&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=AAMRtabout &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;out&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=cmr_t (&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;drop&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=_NAME_);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;by&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; dthrank CODnum2 sex2;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;id&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; yr;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;var&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; CMR_sum;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;run&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;data&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt; cmr2;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;set&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; cmr_t;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;stat=&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;"CMR"&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;format&lt;/FONT&gt; &lt;FONT color="#800080" face="Courier New" size="3"&gt;'2005'N&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;-&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'2016'N&lt;/FONT&gt; &lt;FONT color="#008080" face="Courier New" size="3"&gt;comma8.1&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;run&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;proc&lt;/FONT&gt;&lt;/STRONG&gt; &lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;transpose&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;data&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=AAMRtabout &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;out&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=aamr_t (&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;drop&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=_NAME_);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;by&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; dthrank CODnum2 sex2;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;id&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; yr;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;var&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; AAMR_sum;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;run&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;data&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt; AAMR2;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;set&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; aamr_t;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;stat=&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;"AAMR"&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;format&lt;/FONT&gt; &lt;FONT color="#800080" face="Courier New" size="3"&gt;'2005'N&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;-&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'2016'N&lt;/FONT&gt; &lt;FONT color="#008080" face="Courier New" size="3"&gt;comma8.2&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;run&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;data&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt; AAMRtabout_final; &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;retain&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; dthrank CODnum2 sex2 stat; &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;set&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; death2 cmr2 aamr2;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;run&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 26 Aug 2019 18:55:21 GMT</pubDate>
    <dc:creator>JCO1</dc:creator>
    <dc:date>2019-08-26T18:55:21Z</dc:date>
    <item>
      <title>retain various formats in common variables after combining datasets</title>
      <link>https://communities.sas.com/t5/New-SAS-User/retain-various-formats-in-common-variables-after-combining/m-p/584027#M14082</link>
      <description>&lt;P&gt;The yr variable with a range of 2005-2016 becomes separate variables when the data are transformed.&amp;nbsp; The variable stat has three values, "Deaths," "CMR", and "AAMR" which I format with 0, 1, and 2 decimal places, respectively. They appear that way in the datasets death2, cmr2, and aamr2 columns &lt;FONT color="#800080" face="Courier New" size="3"&gt;'2005'N&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;-&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'2016'N&lt;/FONT&gt; .&amp;nbsp; When I combine the datasets, the &lt;FONT color="#800080" face="Courier New" size="3"&gt;'2005'N&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;-&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'2016'N&lt;/FONT&gt; columns are all formatted to 1 decimal place, instead of 0, 1, and 2 places that I want.&amp;nbsp; The original data have 0 decimals for dths, 8 decimals for CMR and 8 decimals for AAMR.&amp;nbsp; If I comment out the format lines below, the combined dataset has 0, 8, and 8 decimals in the &lt;FONT color="#800080" face="Courier New" size="3"&gt;'2005'N&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;-&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'2016'N&lt;/FONT&gt;&amp;nbsp;columns, demonstrating that they do not have to take the same format.&amp;nbsp; Adding to my perplexity is that my program seemed to work yesterday as intended.&amp;nbsp; I have tried closing and reopening SAS 9.4&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&lt;/FONT&gt; &lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;sort&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;data&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=AAMRtabout; &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;by&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; dthrank CODnum2 sex2; &lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;run&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;proc&lt;/FONT&gt;&lt;/STRONG&gt; &lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;transpose&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;data&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=AAMRtabout &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;out&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=dths_t (&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;drop&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=_NAME_);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;by&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; dthrank CODnum2 sex2;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;id&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; yr;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;var&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; dths_sum;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;run&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;data&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt; death2;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;set&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; dths_t;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;stat=&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;"Deaths"&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;run&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;proc&lt;/FONT&gt;&lt;/STRONG&gt; &lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;transpose&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;data&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=AAMRtabout &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;out&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=cmr_t (&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;drop&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=_NAME_);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;by&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; dthrank CODnum2 sex2;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;id&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; yr;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;var&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; CMR_sum;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;run&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;data&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt; cmr2;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;set&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; cmr_t;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;stat=&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;"CMR"&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;format&lt;/FONT&gt; &lt;FONT color="#800080" face="Courier New" size="3"&gt;'2005'N&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;-&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'2016'N&lt;/FONT&gt; &lt;FONT color="#008080" face="Courier New" size="3"&gt;comma8.1&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;run&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;proc&lt;/FONT&gt;&lt;/STRONG&gt; &lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;transpose&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;data&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=AAMRtabout &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;out&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=aamr_t (&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;drop&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=_NAME_);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;by&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; dthrank CODnum2 sex2;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;id&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; yr;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;var&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; AAMR_sum;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;run&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;data&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt; AAMR2;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;set&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; aamr_t;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;stat=&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;"AAMR"&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;format&lt;/FONT&gt; &lt;FONT color="#800080" face="Courier New" size="3"&gt;'2005'N&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;-&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'2016'N&lt;/FONT&gt; &lt;FONT color="#008080" face="Courier New" size="3"&gt;comma8.2&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;run&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;data&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt; AAMRtabout_final; &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;retain&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; dthrank CODnum2 sex2 stat; &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;set&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; death2 cmr2 aamr2;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;run&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 26 Aug 2019 18:55:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/retain-various-formats-in-common-variables-after-combining/m-p/584027#M14082</guid>
      <dc:creator>JCO1</dc:creator>
      <dc:date>2019-08-26T18:55:21Z</dc:date>
    </item>
    <item>
      <title>Re: retain various formats in common variables after combining datasets</title>
      <link>https://communities.sas.com/t5/New-SAS-User/retain-various-formats-in-common-variables-after-combining/m-p/584053#M14094</link>
      <description>&lt;P&gt;You cannot have multiple formats for the same variable in SAS. The format is a property of the variable, not of every value, as it is in Excel.&lt;/P&gt;
&lt;P&gt;Variable names such as '2005'n are tolerated in SAS, but they will not be created by SAS procedures. Proc transpose will create variable names from numeric fields by prefixing the formatted ID numbers with "_". So, the new variable names will be _2005-_2016.&lt;/P&gt;</description>
      <pubDate>Mon, 26 Aug 2019 19:51:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/retain-various-formats-in-common-variables-after-combining/m-p/584053#M14094</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2019-08-26T19:51:47Z</dc:date>
    </item>
    <item>
      <title>Re: retain various formats in common variables after combining datasets</title>
      <link>https://communities.sas.com/t5/New-SAS-User/retain-various-formats-in-common-variables-after-combining/m-p/584055#M14096</link>
      <description>&lt;P&gt;I cannot match your comments to the code you posted.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;First thing to remember that each variable can have only one format attached to it that will apply to all observations in the dataset.&amp;nbsp; Just like it has only one name, type, length or label.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you rotate up many observations into separate variables, as you are doing with your ID statements, then all of the variables created will inherit any format that might have been attached to the variable listed in the VAR statement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you combine many datasets as you are doing in your last step then the format attached to the variable in the output dataset will be the first format found for that variable among input datasets.&amp;nbsp; Note that datasets that either do not contain the specific variable (so perhaps some of your data did not contain data for one of the years) or if they have the variable but no format has been permanently attached then it will be ignored when trying to determine the format to attach.&amp;nbsp; So if DEATH2 has '2014'n defined with no format attached and CMR has '2014'n defined with COMMA8.1 then the variable will use COMMA8.1.&amp;nbsp; Unless of course your data step attaches a format to the variable. In that case the format defined by the FORMAT statement will override any format attached in the input datasets.&lt;/P&gt;</description>
      <pubDate>Mon, 26 Aug 2019 19:52:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/retain-various-formats-in-common-variables-after-combining/m-p/584055#M14096</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-08-26T19:52:05Z</dc:date>
    </item>
    <item>
      <title>Re: retain various formats in common variables after combining datasets</title>
      <link>https://communities.sas.com/t5/New-SAS-User/retain-various-formats-in-common-variables-after-combining/m-p/584215#M14153</link>
      <description>Thanks. Both replies were not wrong. I converted the year variables from numeric to character and assigned them the formats desired, e.g.&lt;BR /&gt;data death2;&lt;BR /&gt;set dths_t;&lt;BR /&gt;stat="Deaths";&lt;BR /&gt;_2005=put('2005'N, comma8.0);&lt;BR /&gt;data cmr2;&lt;BR /&gt;set cmr_t;&lt;BR /&gt;stat="CMR";&lt;BR /&gt;_2005=put('2005'N, comma8.1);&lt;BR /&gt;</description>
      <pubDate>Tue, 27 Aug 2019 13:15:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/retain-various-formats-in-common-variables-after-combining/m-p/584215#M14153</guid>
      <dc:creator>JCO1</dc:creator>
      <dc:date>2019-08-27T13:15:35Z</dc:date>
    </item>
  </channel>
</rss>

