<?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 combining two dataset different format in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/combining-two-dataset-different-format/m-p/639857#M190420</link>
    <description>&lt;P&gt;I have two dataset with different variable formats&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;dataset #1&lt;/P&gt;
&lt;TABLE style="border-collapse: collapse; width: 144pt;" border="0" width="192" cellspacing="0" cellpadding="0"&gt;
&lt;TBODY&gt;
&lt;TR style="height: 14.5pt;"&gt;
&lt;TD width="64" height="19" class="xl65" style="height: 14.5pt; width: 48pt;"&gt;reasons&lt;/TD&gt;
&lt;TD width="64" class="xl65" style="border-left: none; width: 48pt;"&gt;group1&lt;/TD&gt;
&lt;TD width="64" class="xl65" style="border-left: none; width: 48pt;"&gt;group2&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.5pt;"&gt;
&lt;TD height="19" class="xl65" style="height: 14.5pt; border-top: none;"&gt;reason1&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;1 (6%)&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;10 (48%)&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.5pt;"&gt;
&lt;TD height="19" class="xl65" style="height: 14.5pt; border-top: none;"&gt;reason2&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;4 (22%)&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;7 (33%)&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.5pt;"&gt;
&lt;TD height="19" class="xl65" style="height: 14.5pt; border-top: none;"&gt;reason3&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;6 (33%)&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;1 (5%)&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.5pt;"&gt;
&lt;TD height="19" class="xl65" style="height: 14.5pt; border-top: none;"&gt;reason4&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;7 (39%)&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;3 (14%)&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;group1 and group2 format are both $22.;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;dataset2;&lt;/P&gt;
&lt;TABLE style="border-collapse: collapse; width: 144pt;" border="0" width="192" cellspacing="0" cellpadding="0"&gt;
&lt;TBODY&gt;
&lt;TR style="height: 14.5pt;"&gt;
&lt;TD width="64" height="19" class="xl65" style="height: 14.5pt; width: 48pt;"&gt;reasons&lt;/TD&gt;
&lt;TD width="64" class="xl65" style="border-left: none; width: 48pt;"&gt;group1&lt;/TD&gt;
&lt;TD width="64" class="xl65" style="border-left: none; width: 48pt;"&gt;group2&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.5pt;"&gt;
&lt;TD height="19" class="xl65" style="height: 14.5pt; border-top: none;"&gt;TOTAL&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;18&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;21&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;group1 and group2 are best12.;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;i want to combine using UNION both tables to this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;TABLE style="border-collapse: collapse; width: 144pt;" border="0" width="192" cellspacing="0" cellpadding="0"&gt;
&lt;TBODY&gt;
&lt;TR style="height: 14.5pt;"&gt;
&lt;TD width="64" height="19" class="xl66" style="height: 14.5pt; width: 48pt;"&gt;reasons&lt;/TD&gt;
&lt;TD width="64" class="xl67" style="border-left: none; width: 48pt;"&gt;group1&lt;/TD&gt;
&lt;TD width="64" class="xl67" style="border-left: none; width: 48pt;"&gt;group2&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.5pt;"&gt;
&lt;TD height="19" class="xl66" style="height: 14.5pt; border-top: none;"&gt;reason1&lt;/TD&gt;
&lt;TD class="xl67" style="border-top: none; border-left: none;"&gt;1 (6%)&lt;/TD&gt;
&lt;TD class="xl67" style="border-top: none; border-left: none;"&gt;10 (48%)&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.5pt;"&gt;
&lt;TD height="19" class="xl66" style="height: 14.5pt; border-top: none;"&gt;reason2&lt;/TD&gt;
&lt;TD class="xl67" style="border-top: none; border-left: none;"&gt;4 (22%)&lt;/TD&gt;
&lt;TD class="xl67" style="border-top: none; border-left: none;"&gt;7 (33%)&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.5pt;"&gt;
&lt;TD height="19" class="xl66" style="height: 14.5pt; border-top: none;"&gt;reason3&lt;/TD&gt;
&lt;TD class="xl67" style="border-top: none; border-left: none;"&gt;6 (33%)&lt;/TD&gt;
&lt;TD class="xl67" style="border-top: none; border-left: none;"&gt;1 (5%)&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.5pt;"&gt;
&lt;TD height="19" class="xl66" style="height: 14.5pt; border-top: none;"&gt;reason4&lt;/TD&gt;
&lt;TD class="xl67" style="border-top: none; border-left: none;"&gt;7 (39%)&lt;/TD&gt;
&lt;TD class="xl67" style="border-top: none; border-left: none;"&gt;3 (14%)&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.5pt;"&gt;
&lt;TD height="19" class="xl66" style="height: 14.5pt; border-top: none;"&gt;TOTAL&lt;/TD&gt;
&lt;TD class="xl67" style="border-top: none; border-left: none;"&gt;18&lt;/TD&gt;
&lt;TD class="xl67" style="border-top: none; border-left: none;"&gt;21&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I did:&lt;/P&gt;
&lt;P&gt;proc sql;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;create table want_merge as&lt;/P&gt;
&lt;P&gt;select&amp;nbsp; * from dataset1&lt;/P&gt;
&lt;P&gt;union all&lt;/P&gt;
&lt;P&gt;select * from dataset2;&lt;/P&gt;
&lt;P&gt;quit;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am getting error "group 1 has been defined as both character and numeric' . i changed the format in each dataset to 22.; but still not work&lt;/P&gt;</description>
    <pubDate>Tue, 14 Apr 2020 18:26:53 GMT</pubDate>
    <dc:creator>monday89</dc:creator>
    <dc:date>2020-04-14T18:26:53Z</dc:date>
    <item>
      <title>combining two dataset different format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/combining-two-dataset-different-format/m-p/639857#M190420</link>
      <description>&lt;P&gt;I have two dataset with different variable formats&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;dataset #1&lt;/P&gt;
&lt;TABLE style="border-collapse: collapse; width: 144pt;" border="0" width="192" cellspacing="0" cellpadding="0"&gt;
&lt;TBODY&gt;
&lt;TR style="height: 14.5pt;"&gt;
&lt;TD width="64" height="19" class="xl65" style="height: 14.5pt; width: 48pt;"&gt;reasons&lt;/TD&gt;
&lt;TD width="64" class="xl65" style="border-left: none; width: 48pt;"&gt;group1&lt;/TD&gt;
&lt;TD width="64" class="xl65" style="border-left: none; width: 48pt;"&gt;group2&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.5pt;"&gt;
&lt;TD height="19" class="xl65" style="height: 14.5pt; border-top: none;"&gt;reason1&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;1 (6%)&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;10 (48%)&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.5pt;"&gt;
&lt;TD height="19" class="xl65" style="height: 14.5pt; border-top: none;"&gt;reason2&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;4 (22%)&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;7 (33%)&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.5pt;"&gt;
&lt;TD height="19" class="xl65" style="height: 14.5pt; border-top: none;"&gt;reason3&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;6 (33%)&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;1 (5%)&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.5pt;"&gt;
&lt;TD height="19" class="xl65" style="height: 14.5pt; border-top: none;"&gt;reason4&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;7 (39%)&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;3 (14%)&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;group1 and group2 format are both $22.;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;dataset2;&lt;/P&gt;
&lt;TABLE style="border-collapse: collapse; width: 144pt;" border="0" width="192" cellspacing="0" cellpadding="0"&gt;
&lt;TBODY&gt;
&lt;TR style="height: 14.5pt;"&gt;
&lt;TD width="64" height="19" class="xl65" style="height: 14.5pt; width: 48pt;"&gt;reasons&lt;/TD&gt;
&lt;TD width="64" class="xl65" style="border-left: none; width: 48pt;"&gt;group1&lt;/TD&gt;
&lt;TD width="64" class="xl65" style="border-left: none; width: 48pt;"&gt;group2&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.5pt;"&gt;
&lt;TD height="19" class="xl65" style="height: 14.5pt; border-top: none;"&gt;TOTAL&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;18&lt;/TD&gt;
&lt;TD align="right" class="xl65" style="border-top: none; border-left: none;"&gt;21&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;group1 and group2 are best12.;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;i want to combine using UNION both tables to this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;TABLE style="border-collapse: collapse; width: 144pt;" border="0" width="192" cellspacing="0" cellpadding="0"&gt;
&lt;TBODY&gt;
&lt;TR style="height: 14.5pt;"&gt;
&lt;TD width="64" height="19" class="xl66" style="height: 14.5pt; width: 48pt;"&gt;reasons&lt;/TD&gt;
&lt;TD width="64" class="xl67" style="border-left: none; width: 48pt;"&gt;group1&lt;/TD&gt;
&lt;TD width="64" class="xl67" style="border-left: none; width: 48pt;"&gt;group2&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.5pt;"&gt;
&lt;TD height="19" class="xl66" style="height: 14.5pt; border-top: none;"&gt;reason1&lt;/TD&gt;
&lt;TD class="xl67" style="border-top: none; border-left: none;"&gt;1 (6%)&lt;/TD&gt;
&lt;TD class="xl67" style="border-top: none; border-left: none;"&gt;10 (48%)&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.5pt;"&gt;
&lt;TD height="19" class="xl66" style="height: 14.5pt; border-top: none;"&gt;reason2&lt;/TD&gt;
&lt;TD class="xl67" style="border-top: none; border-left: none;"&gt;4 (22%)&lt;/TD&gt;
&lt;TD class="xl67" style="border-top: none; border-left: none;"&gt;7 (33%)&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.5pt;"&gt;
&lt;TD height="19" class="xl66" style="height: 14.5pt; border-top: none;"&gt;reason3&lt;/TD&gt;
&lt;TD class="xl67" style="border-top: none; border-left: none;"&gt;6 (33%)&lt;/TD&gt;
&lt;TD class="xl67" style="border-top: none; border-left: none;"&gt;1 (5%)&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.5pt;"&gt;
&lt;TD height="19" class="xl66" style="height: 14.5pt; border-top: none;"&gt;reason4&lt;/TD&gt;
&lt;TD class="xl67" style="border-top: none; border-left: none;"&gt;7 (39%)&lt;/TD&gt;
&lt;TD class="xl67" style="border-top: none; border-left: none;"&gt;3 (14%)&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 14.5pt;"&gt;
&lt;TD height="19" class="xl66" style="height: 14.5pt; border-top: none;"&gt;TOTAL&lt;/TD&gt;
&lt;TD class="xl67" style="border-top: none; border-left: none;"&gt;18&lt;/TD&gt;
&lt;TD class="xl67" style="border-top: none; border-left: none;"&gt;21&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I did:&lt;/P&gt;
&lt;P&gt;proc sql;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;create table want_merge as&lt;/P&gt;
&lt;P&gt;select&amp;nbsp; * from dataset1&lt;/P&gt;
&lt;P&gt;union all&lt;/P&gt;
&lt;P&gt;select * from dataset2;&lt;/P&gt;
&lt;P&gt;quit;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am getting error "group 1 has been defined as both character and numeric' . i changed the format in each dataset to 22.; but still not work&lt;/P&gt;</description>
      <pubDate>Tue, 14 Apr 2020 18:26:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/combining-two-dataset-different-format/m-p/639857#M190420</guid>
      <dc:creator>monday89</dc:creator>
      <dc:date>2020-04-14T18:26:53Z</dc:date>
    </item>
    <item>
      <title>Re: combining two dataset different format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/combining-two-dataset-different-format/m-p/639860#M190423</link>
      <description>&lt;P&gt;We'd need to see your actual SAS data sets, and how they were created. What you have shown us is not a SAS data set, it is an output from a PROC, and non-informative.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In any event, in the creation of data set #1 and data set #2, somehow you have created group1 as numeric in one and group1 as character in the other, and that has to be fixed so they are both character, or both numeric.&lt;/P&gt;</description>
      <pubDate>Tue, 14 Apr 2020 18:34:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/combining-two-dataset-different-format/m-p/639860#M190423</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-04-14T18:34:09Z</dc:date>
    </item>
    <item>
      <title>Re: combining two dataset different format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/combining-two-dataset-different-format/m-p/639862#M190424</link>
      <description>&lt;P&gt;Yes, I understand. Dataset1 is derived dataset for calculations and dataset2 is the denominator.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;TABLE width="241"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="69"&gt;dataset1&lt;/TD&gt;
&lt;TD width="45"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD width="42"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD width="85"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="69"&gt;Variable&lt;/TD&gt;
&lt;TD width="45"&gt;Type&lt;/TD&gt;
&lt;TD width="42"&gt;Len&lt;/TD&gt;
&lt;TD width="85"&gt;Label&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="69"&gt;reasons&lt;/TD&gt;
&lt;TD width="45"&gt;Char&lt;/TD&gt;
&lt;TD width="42"&gt;1000&lt;/TD&gt;
&lt;TD width="85"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="69"&gt;group1&lt;/TD&gt;
&lt;TD width="45"&gt;Char&lt;/TD&gt;
&lt;TD width="42"&gt;22&lt;/TD&gt;
&lt;TD width="85"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="69"&gt;group2&lt;/TD&gt;
&lt;TD width="45"&gt;Char&lt;/TD&gt;
&lt;TD width="42"&gt;22&lt;/TD&gt;
&lt;TD width="85"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;TABLE width="241"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="69"&gt;dataset2&lt;/TD&gt;
&lt;TD width="45"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD width="42"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD width="85"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="69"&gt;Variable&lt;/TD&gt;
&lt;TD width="45"&gt;Type&lt;/TD&gt;
&lt;TD width="42"&gt;Len&lt;/TD&gt;
&lt;TD width="85"&gt;Label&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="69"&gt;reasons&lt;/TD&gt;
&lt;TD width="45"&gt;Char&lt;/TD&gt;
&lt;TD width="42"&gt;5&lt;/TD&gt;
&lt;TD width="85"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="69"&gt;group1&lt;/TD&gt;
&lt;TD width="45"&gt;Num&lt;/TD&gt;
&lt;TD width="42"&gt;8&lt;/TD&gt;
&lt;TD width="85"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="69"&gt;group2&lt;/TD&gt;
&lt;TD width="45"&gt;Num&lt;/TD&gt;
&lt;TD width="42"&gt;8&lt;/TD&gt;
&lt;TD width="85"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am trying forcing all variables to be character format. Not so much worried about what is in it. THANK YOU&lt;/P&gt;</description>
      <pubDate>Tue, 14 Apr 2020 18:38:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/combining-two-dataset-different-format/m-p/639862#M190424</guid>
      <dc:creator>monday89</dc:creator>
      <dc:date>2020-04-14T18:38:36Z</dc:date>
    </item>
    <item>
      <title>Re: combining two dataset different format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/combining-two-dataset-different-format/m-p/639863#M190425</link>
      <description>&lt;P&gt;So you have to create these data sets differently, so that group1 is numeric in both (or character in both); and the same for group2.&lt;/P&gt;</description>
      <pubDate>Tue, 14 Apr 2020 18:39:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/combining-two-dataset-different-format/m-p/639863#M190425</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-04-14T18:39:49Z</dc:date>
    </item>
  </channel>
</rss>

