<?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 tables in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Comparing-tables/m-p/518917#M140473</link>
    <description>thankyou I stacked and did a proc freq&lt;BR /&gt;Is it correct to use 2 where statements in a proc freq&lt;BR /&gt;where section=1;&lt;BR /&gt;pxblock in (1,2,);&lt;BR /&gt;run;</description>
    <pubDate>Wed, 05 Dec 2018 19:41:44 GMT</pubDate>
    <dc:creator>Ranjeeta</dc:creator>
    <dc:date>2018-12-05T19:41:44Z</dc:date>
    <item>
      <title>Comparing tables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Comparing-tables/m-p/518879#M140464</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have tables for 6 years 2012 to 2017&lt;/P&gt;&lt;P&gt;I have a list of codes in each table that I want to compare&amp;nbsp;&lt;/P&gt;&lt;P&gt;Basically I want to create a table that tells me which codes have changed over the years?&lt;/P&gt;&lt;P&gt;E.g.&amp;nbsp;&amp;nbsp;if 1HA80QB is present from 2012 to 2016 and then it disappeared in 2017 i need to kow that&lt;/P&gt;&lt;P&gt;or a new code appeared in 2017 onwards which was not present in prior years?&lt;/P&gt;&lt;P&gt;How would i compare these 6 tables?&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please advise&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 05 Dec 2018 18:05:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Comparing-tables/m-p/518879#M140464</guid>
      <dc:creator>Ranjeeta</dc:creator>
      <dc:date>2018-12-05T18:05:43Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing tables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Comparing-tables/m-p/518882#M140465</link>
      <description>Do the tables have duplicates or is each code only in there once? The simplest method is to stack the data sets, add a variable for year (use INDSNAME) and then transpose the data to a wide format. You'll get a data set that looks like:&lt;BR /&gt;&lt;BR /&gt;CODE Year2017 Year2016 .. Year2012 with a 1 or . for each code that's missing.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 05 Dec 2018 18:09:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Comparing-tables/m-p/518882#M140465</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-12-05T18:09:21Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing tables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Comparing-tables/m-p/518917#M140473</link>
      <description>thankyou I stacked and did a proc freq&lt;BR /&gt;Is it correct to use 2 where statements in a proc freq&lt;BR /&gt;where section=1;&lt;BR /&gt;pxblock in (1,2,);&lt;BR /&gt;run;</description>
      <pubDate>Wed, 05 Dec 2018 19:41:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Comparing-tables/m-p/518917#M140473</guid>
      <dc:creator>Ranjeeta</dc:creator>
      <dc:date>2018-12-05T19:41:44Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing tables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Comparing-tables/m-p/518920#M140476</link>
      <description>Not in the way shown. Instead combine them using an AND or OR as appropriate. &lt;BR /&gt;&lt;BR /&gt;where section = 1 AND pxblock in (1,2);&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 05 Dec 2018 19:51:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Comparing-tables/m-p/518920#M140476</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-12-05T19:51:52Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing tables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Comparing-tables/m-p/518921#M140477</link>
      <description>Note that proc freq will give you the output displayed. If you want it in a SAS data set, you'll need the transpose step.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 05 Dec 2018 19:52:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Comparing-tables/m-p/518921#M140477</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-12-05T19:52:45Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing tables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Comparing-tables/m-p/518931#M140485</link>
      <description>How would I write the proc transpose&lt;BR /&gt;proc transpose data=combined (keep =fyear ccicode);&lt;BR /&gt;var fyear;&lt;BR /&gt;run;&lt;BR /&gt;</description>
      <pubDate>Wed, 05 Dec 2018 20:16:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Comparing-tables/m-p/518931#M140485</guid>
      <dc:creator>Ranjeeta</dc:creator>
      <dc:date>2018-12-05T20:16:39Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing tables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Comparing-tables/m-p/518932#M140486</link>
      <description>sas just hangs when i try to do proc transpose</description>
      <pubDate>Wed, 05 Dec 2018 20:17:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Comparing-tables/m-p/518932#M140486</guid>
      <dc:creator>Ranjeeta</dc:creator>
      <dc:date>2018-12-05T20:17:21Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing tables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Comparing-tables/m-p/518935#M140487</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/240770"&gt;@Ranjeeta&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;How would I write the proc transpose&lt;BR /&gt;proc transpose data=combined (keep =fyear ccicode);&lt;BR /&gt;var fyear;&lt;BR /&gt;run;&lt;BR /&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;most likely like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;proc transpose data=have out=want prefix=Year;
by Code;
ID year;
Var ; &lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;*what value you want to be transposed, may need to add one in previous step;&lt;/STRONG&gt;&lt;/FONT&gt;
run;&lt;/PRE&gt;</description>
      <pubDate>Wed, 05 Dec 2018 20:28:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Comparing-tables/m-p/518935#M140487</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-12-05T20:28:29Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing tables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Comparing-tables/m-p/518964#M140496</link>
      <description>data summary other&lt;BR /&gt;merge px2011(in=In2011) px 2012(In=In2012);&lt;BR /&gt;by px_code;&lt;BR /&gt;if in (In2011,In2012) then output summary&lt;BR /&gt;else output other;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;Can you also please advise how to modify the above step to create a summary column if the code is present in the 2 years&lt;BR /&gt;Basically want to see a table of codes that would not have a total of 2&lt;BR /&gt;Im doing the above for 7 years actuaaly&lt;BR /&gt;Thnx&lt;BR /&gt;</description>
      <pubDate>Wed, 05 Dec 2018 22:21:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Comparing-tables/m-p/518964#M140496</guid>
      <dc:creator>Ranjeeta</dc:creator>
      <dc:date>2018-12-05T22:21:30Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing tables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Comparing-tables/m-p/518972#M140504</link>
      <description>&lt;P&gt;I meant append, not merge.&lt;/P&gt;
&lt;P&gt;Untested obviously, but this is the idea.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data long;
set px2011-px2017 indsname = source;

name = source;
DummyVar=1;
run;

proc sort data=have; 
by px_code name;
run;

proc transpose data=long out=wide prefix=Year_;
by px_code;
id name;
var DummyVar;
run;

data want;
set wide;

CountYears = sum(of year_:);
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 05 Dec 2018 22:47:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Comparing-tables/m-p/518972#M140504</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-12-05T22:47:59Z</dc:date>
    </item>
  </channel>
</rss>

