<?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: merging two tables in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/merging-two-tables/m-p/848236#M82357</link>
    <description>&lt;P&gt;Your pictures don't have label to tell what data set they represent.&lt;/P&gt;
&lt;P&gt;I think that you may actually have two separate counts of interest as the proc freq code generates a variable named count but then you recount the number of levels of variables with your Proc sql. So you lose the original counts with that. Then the merge aggravates that by combing rows of data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am going to suggest that you look at the output from this and see if one (or both) of the tables have the values that you might be looking for. Not a data set, a report that people read.&lt;/P&gt;
&lt;PRE&gt;proc tabulate data=Listing2;
   class sex exdstxt;
   table SEX*EXDSTXT Exdstxt ,
         n colpctn;
   table Exdstxt*(sex all='all sexes'),
         n colpctn pctn;
run;

&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 07 Dec 2022 00:03:00 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2022-12-07T00:03:00Z</dc:date>
    <item>
      <title>merging two tables</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/merging-two-tables/m-p/848199#M82353</link>
      <description>&lt;P&gt;I am merging 2 datas by treatment to calculate the percentage, the count and the percentage together. One has the frequency of sex by treatment and the other is just the treatment. When merged, the count of the female treatment changes to the count of the total treatment. What can be done?&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Ayooo1_0-1670357461672.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/78133iEDE2C3F3BB1F6C7C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Ayooo1_0-1670357461672.png" alt="Ayooo1_0-1670357461672.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Ayooo1_1-1670357473092.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/78134iD03C970D8319A24E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Ayooo1_1-1670357473092.png" alt="Ayooo1_1-1670357473092.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Ayooo1_3-1670357548085.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/78136i6D98A56164CBA9C8/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Ayooo1_3-1670357548085.png" alt="Ayooo1_3-1670357548085.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 06 Dec 2022 20:14:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/merging-two-tables/m-p/848199#M82353</guid>
      <dc:creator>Ayooo1</dc:creator>
      <dc:date>2022-12-06T20:14:59Z</dc:date>
    </item>
    <item>
      <title>Re: merging two tables</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/merging-two-tables/m-p/848200#M82354</link>
      <description>&lt;P&gt;I see no variable called "treatment" in your pictures.&lt;/P&gt;
&lt;P&gt;Please post examples for your datasets in usable form (data steps with datalines,&amp;nbsp;&lt;STRONG&gt;do not skip this!&lt;/STRONG&gt;) and your code.&lt;/P&gt;</description>
      <pubDate>Tue, 06 Dec 2022 20:23:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/merging-two-tables/m-p/848200#M82354</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-12-06T20:23:13Z</dc:date>
    </item>
    <item>
      <title>Re: merging two tables</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/merging-two-tables/m-p/848203#M82356</link>
      <description>&lt;P&gt;EXDSTXT represents treatment.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;proc freq data=Listing2;
tables SEX*EXDSTXT /out=FreqST;
tables EXDSTXT/out=FreqT;
run;
proc sort data=FreqST;
by EXDSTXT SEX;
run;
proc sort data=FreqT;
by EXDSTXT;
run;
proc sql;
select SEX, EXDSTXT, count(*) as Count
from FreqST
group by SEX,EXDSTXT;
select EXDSTXT, count (*) as Count
from FreqT
group by EXDSTXT;
quit;
data Listing2_1;
merge FreqST(in=a) FreqT(in=b);
by EXDSTXT;
if a and b;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 06 Dec 2022 20:30:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/merging-two-tables/m-p/848203#M82356</guid>
      <dc:creator>Ayooo1</dc:creator>
      <dc:date>2022-12-06T20:30:17Z</dc:date>
    </item>
    <item>
      <title>Re: merging two tables</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/merging-two-tables/m-p/848236#M82357</link>
      <description>&lt;P&gt;Your pictures don't have label to tell what data set they represent.&lt;/P&gt;
&lt;P&gt;I think that you may actually have two separate counts of interest as the proc freq code generates a variable named count but then you recount the number of levels of variables with your Proc sql. So you lose the original counts with that. Then the merge aggravates that by combing rows of data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am going to suggest that you look at the output from this and see if one (or both) of the tables have the values that you might be looking for. Not a data set, a report that people read.&lt;/P&gt;
&lt;PRE&gt;proc tabulate data=Listing2;
   class sex exdstxt;
   table SEX*EXDSTXT Exdstxt ,
         n colpctn;
   table Exdstxt*(sex all='all sexes'),
         n colpctn pctn;
run;

&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Dec 2022 00:03:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/merging-two-tables/m-p/848236#M82357</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2022-12-07T00:03:00Z</dc:date>
    </item>
    <item>
      <title>Re: merging two tables</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/merging-two-tables/m-p/848427#M82359</link>
      <description>&lt;P&gt;thank you. This helped a lot.&lt;/P&gt;</description>
      <pubDate>Wed, 07 Dec 2022 21:30:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/merging-two-tables/m-p/848427#M82359</guid>
      <dc:creator>Ayooo1</dc:creator>
      <dc:date>2022-12-07T21:30:24Z</dc:date>
    </item>
  </channel>
</rss>

