<?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: Comparing same variable (freq, count, etc) from two datasets in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Comparing-same-variable-freq-count-etc-from-two-datasets/m-p/252275#M56806</link>
    <description>&lt;P&gt;Make one dataset and then run your proc freqs with the source as a crosstab variable.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data stacked;
Set data1 data2 indsname=source;
Dset=source;
Run;

Proc freq data=stacked;
By district;
Table varx * dset;
Run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 25 Feb 2016 02:57:20 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2016-02-25T02:57:20Z</dc:date>
    <item>
      <title>Comparing same variable (freq, count, etc) from two datasets</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Comparing-same-variable-freq-count-etc-from-two-datasets/m-p/252274#M56805</link>
      <description>&lt;P&gt;Hi experts!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So, I have two datasets, a midline and an endline. They have identical variables (different observations though, obviously) and I want to be able to compare changes in frequencies, etc between the two without having to go line by line in my output tables from each respective data sets' proc freq. I have 4 districts I'm looking at, and all of my proc freqs are stratified by these districtss. So, for example, what if I want to know the differences between how&amp;nbsp;many said x, y, or z in response to indicator 4, from each set? Is there a way to do this?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I found this macro:&amp;nbsp;&lt;A href="http://www2.sas.com/proceedings/sugi26/p097-26.pdf" target="_blank"&gt;http://www2.sas.com/proceedings/sugi26/p097-26.pdf&lt;/A&gt; but to be honest I have no idea how to input the info related to my data sets. I also tried proc compare, but I have no idea what the output means. As I'm sure you can tell, I'm pretty limited in my SAS knowledge and have been having trouble with the more nuanced procedures/code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ANY help at all would be greatly appreciated! Thank you!&lt;/P&gt;</description>
      <pubDate>Thu, 25 Feb 2016 02:32:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Comparing-same-variable-freq-count-etc-from-two-datasets/m-p/252274#M56805</guid>
      <dc:creator>chelsealutz</dc:creator>
      <dc:date>2016-02-25T02:32:07Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing same variable (freq, count, etc) from two datasets</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Comparing-same-variable-freq-count-etc-from-two-datasets/m-p/252275#M56806</link>
      <description>&lt;P&gt;Make one dataset and then run your proc freqs with the source as a crosstab variable.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data stacked;
Set data1 data2 indsname=source;
Dset=source;
Run;

Proc freq data=stacked;
By district;
Table varx * dset;
Run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 25 Feb 2016 02:57:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Comparing-same-variable-freq-count-etc-from-two-datasets/m-p/252275#M56806</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-02-25T02:57:20Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing same variable (freq, count, etc) from two datasets</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Comparing-same-variable-freq-count-etc-from-two-datasets/m-p/252500#M56830</link>
      <description>&lt;P&gt;I'm afraid I got this error:&lt;/P&gt;&lt;P&gt;Proc freq data=stacked;&lt;BR /&gt;1425 By dist;&lt;BR /&gt;1426 Table tb*dset;&lt;BR /&gt;1427 Run;&lt;/P&gt;&lt;P&gt;NOTE: Writing HTML Body file: sashtml.htm&lt;BR /&gt;ERROR: Data set WORK.STACKED is not sorted in ascending sequence. The current BY group has&lt;BR /&gt;dist = Samfya and the next BY group has dist = Luwingu.&lt;BR /&gt;NOTE: The SAS System stopped processing this step because of errors.&lt;BR /&gt;NOTE: There were 343 observations read from the data set WORK.STACKED.&lt;BR /&gt;NOTE: PROCEDURE FREQ used (Total process time):&lt;BR /&gt;real time 1.29 seconds&lt;BR /&gt;cpu time 0.32 seconds&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And this output:&lt;/P&gt;&lt;DIV class="c proctitle"&gt;The FREQ Procedure&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV class="c byline"&gt;dist=Chienge&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV align="center"&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;DIV align="center"&gt;Frequency Percent Row Pct Col Pct&lt;/DIV&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/DIV&gt;&lt;DIV align="center"&gt;Table&amp;nbsp;of&amp;nbsp;tb&amp;nbsp;by&amp;nbsp;Dset tb Dset data1 Total 1 2 Total &lt;TABLE cellspacing="0" cellpadding="3"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;TABLE border="0" cellspacing="0" cellpadding="3"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;124&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;72.94&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;100.00&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;72.94&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/TD&gt;&lt;TD&gt;&lt;TABLE border="0" cellspacing="0" cellpadding="3"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;124&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;72.94&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;TABLE border="0" cellspacing="0" cellpadding="3"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;46&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;27.06&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;100.00&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;27.06&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/TD&gt;&lt;TD&gt;&lt;TABLE border="0" cellspacing="0" cellpadding="3"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;46&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;27.06&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;TABLE border="0" cellspacing="0" cellpadding="3"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;170&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;100.00&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/TD&gt;&lt;TD&gt;&lt;TABLE border="0" cellspacing="0" cellpadding="3"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;170&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;100.00&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Which is obviously only half of what I want. I apologize for being so new, I just don't know what this code is doing exactly. I understand combining the two datasets, but what exactly is the indsname option, or "source?"&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data stacked;
Set data1 data2 indsname=source;
Dset=source;
Run;

Proc freq data=stacked;
By district;
Table tb*dset;
Run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;That is what I ran...&amp;nbsp;&lt;/P&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 25 Feb 2016 19:49:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Comparing-same-variable-freq-count-etc-from-two-datasets/m-p/252500#M56830</guid>
      <dc:creator>chelsealutz</dc:creator>
      <dc:date>2016-02-25T19:49:01Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing same variable (freq, count, etc) from two datasets</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Comparing-same-variable-freq-count-etc-from-two-datasets/m-p/252525#M56831</link>
      <description>&lt;P&gt;Almost there. &amp;nbsp;Just need to sort by the dist variable:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data stacked;
Set data1 data2 indsname=source;
Dset=source;
Run;

proc sort data=stacked; by dist; run;

Proc freq data=stacked;
By dist;
Table tb*dset;
Run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;BR /&gt;The INDSNAME option takes the name of the origin&amp;nbsp;data set for each record and puts it into a category variable (DSET, eventually) so you can compare the two populations.&lt;/P&gt;</description>
      <pubDate>Thu, 25 Feb 2016 20:06:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Comparing-same-variable-freq-count-etc-from-two-datasets/m-p/252525#M56831</guid>
      <dc:creator>ChrisHemedinger</dc:creator>
      <dc:date>2016-02-25T20:06:28Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing same variable (freq, count, etc) from two datasets</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Comparing-same-variable-freq-count-etc-from-two-datasets/m-p/252529#M56832</link>
      <description>&lt;P&gt;Thank you for clarifying! And&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza﻿&lt;/a&gt;, thank you for that first step!&lt;/P&gt;</description>
      <pubDate>Thu, 25 Feb 2016 20:34:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Comparing-same-variable-freq-count-etc-from-two-datasets/m-p/252529#M56832</guid>
      <dc:creator>chelsealutz</dc:creator>
      <dc:date>2016-02-25T20:34:43Z</dc:date>
    </item>
  </channel>
</rss>

