<?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: How do create a table that compares across three or more datasets using Proc SQL? in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/How-do-create-a-table-that-compares-across-three-or-more/m-p/551492#M74562</link>
    <description>&lt;P&gt;HI&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/270885"&gt;@StephenPM33&lt;/a&gt;&amp;nbsp; Can you please post a sample data of what you HAVE and what you WANT(expected output) explaining your requirement. I am sure that will help somebody to work and test their solution before they post.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Btw, noticing your 1st post, welcome to SAS communities.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 16 Apr 2019 18:03:37 GMT</pubDate>
    <dc:creator>novinosrin</dc:creator>
    <dc:date>2019-04-16T18:03:37Z</dc:date>
    <item>
      <title>How do create a table that compares across three or more datasets using Proc SQL?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-do-create-a-table-that-compares-across-three-or-more/m-p/551491#M74561</link>
      <description>&lt;P&gt;Using Proc SQL, I want to create a table that displays new reporter numbers that exist in March but don't exist in February or January.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I already created the datasets for January and February and March, now I need to see which report numbers&amp;nbsp;exist in March but don't exist in&amp;nbsp;January or February.&lt;/P&gt;&lt;P&gt;I'm not sure how to compare across three or more datasets using proc sql. Any insight would be appreciated.&lt;/P&gt;</description>
      <pubDate>Tue, 16 Apr 2019 18:01:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-do-create-a-table-that-compares-across-three-or-more/m-p/551491#M74561</guid>
      <dc:creator>StephenPM33</dc:creator>
      <dc:date>2019-04-16T18:01:08Z</dc:date>
    </item>
    <item>
      <title>Re: How do create a table that compares across three or more datasets using Proc SQL?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-do-create-a-table-that-compares-across-three-or-more/m-p/551492#M74562</link>
      <description>&lt;P&gt;HI&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/270885"&gt;@StephenPM33&lt;/a&gt;&amp;nbsp; Can you please post a sample data of what you HAVE and what you WANT(expected output) explaining your requirement. I am sure that will help somebody to work and test their solution before they post.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Btw, noticing your 1st post, welcome to SAS communities.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Apr 2019 18:03:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-do-create-a-table-that-compares-across-three-or-more/m-p/551492#M74562</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2019-04-16T18:03:37Z</dc:date>
    </item>
    <item>
      <title>Re: How do create a table that compares across three or more datasets using Proc SQL?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-do-create-a-table-that-compares-across-three-or-more/m-p/551493#M74563</link>
      <description>&lt;P&gt;Does "numbers exist" mean: NOT (all missing values)?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;A simple solution, but not using PROC SQL, is to append all three data sets, then run PROC SUMMARY where month is a CLASS variable. If the computed N for each variable in each month is greater than zero, then "numbers exist".&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Don't fall into the trap that this absolutely has to be done in PROC SQL.&lt;/P&gt;</description>
      <pubDate>Tue, 16 Apr 2019 18:10:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-do-create-a-table-that-compares-across-three-or-more/m-p/551493#M74563</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-04-16T18:10:27Z</dc:date>
    </item>
    <item>
      <title>Re: How do I create a table that compares across three or more datasets using Proc SQL?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-do-create-a-table-that-compares-across-three-or-more/m-p/551494#M74564</link>
      <description>&lt;P&gt;/*&amp;nbsp;Creation of Masterlist for All Months reports for this Group Number;*/------&amp;gt;I Have This Part&lt;BR /&gt;PROC SQL;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; CREATE TABLE WORK.FILTER_FOR_REGISTRY_CURRENT AS&lt;BR /&gt;&amp;nbsp;&amp;nbsp; SELECT a.*&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FROM MICRO.REGISTRY_CURRENT a&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WHERE a.GROUP_NUMBER = '0000000';&lt;BR /&gt;proc sql;&lt;BR /&gt;&amp;nbsp;create table work.census_in_microdata as&lt;BR /&gt;&amp;nbsp;select a.state_code,a.county_code, a.rept_num, b.data_value, b.datatype, b.version, b.ref_mm, b.ref_yy&lt;BR /&gt;&amp;nbsp;from work.filter_for_registry_current a, micro.microdata_current b&lt;BR /&gt;&amp;nbsp;where a.state_code=b.state_code and a.rept_num=b.rept_num;&lt;BR /&gt;/*&amp;nbsp;Creation of Masterlist for All Months reports for this Group Number;*/&lt;BR /&gt;quit;&lt;BR /&gt;/*&amp;nbsp;Creation of List for January Ref MM reports for this Group Number;*/&lt;BR /&gt;proc sql;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; create table January_Census_Output as&lt;BR /&gt;&amp;nbsp;&amp;nbsp; select state_code, rept_num, data_value, datatype, version, ref_mm, ref_yy&lt;BR /&gt;&amp;nbsp;&amp;nbsp; from work.census_in_microdata&lt;BR /&gt;&amp;nbsp;&amp;nbsp; where ref_mm='01'&lt;BR /&gt;&amp;nbsp;&amp;nbsp; group by state_code, rept_num&lt;BR /&gt;&amp;nbsp;&amp;nbsp; having version=max(version);&lt;BR /&gt;quit;&lt;BR /&gt;&amp;nbsp;/*&amp;nbsp;Creation of List for January Ref MM reports for this Group Number;*/&lt;BR /&gt;&amp;nbsp;/*&amp;nbsp;Creation of List for February Ref MM reports for this Group Number;*/&lt;BR /&gt;proc sql;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; create table February_Census_Output as&lt;BR /&gt;&amp;nbsp;&amp;nbsp; select state_code, rept_num, data_value, datatype, version, ref_mm, ref_yy&lt;BR /&gt;&amp;nbsp;&amp;nbsp; from work.census_in_microdata&lt;BR /&gt;&amp;nbsp;&amp;nbsp; where ref_mm='02'&lt;BR /&gt;&amp;nbsp;&amp;nbsp; group by state_code, rept_num&lt;BR /&gt;&amp;nbsp;&amp;nbsp; having version=max(version);&lt;BR /&gt;quit;&lt;BR /&gt;/*&amp;nbsp;Creation of List for February Ref MM reports for this Group Number;*/&lt;BR /&gt;/*&amp;nbsp;Creation of List for March Ref MM reports for this Group Number;*/&lt;BR /&gt;proc sql;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; create table March_Census_Output as&lt;BR /&gt;&amp;nbsp;&amp;nbsp; select state_code, rept_num, data_value, datatype, version, ref_mm, ref_yy&lt;BR /&gt;&amp;nbsp;&amp;nbsp; from work.census_in_microdata&lt;BR /&gt;&amp;nbsp;&amp;nbsp; where ref_mm='03'&lt;BR /&gt;&amp;nbsp;&amp;nbsp; group by state_code, rept_num&lt;BR /&gt;&amp;nbsp;&amp;nbsp; having version=max(version);&lt;BR /&gt;quit;&lt;BR /&gt;/*&amp;nbsp;Creation of List for March Ref MM reports for this Group Number;*/---------&amp;gt;I Have This Part&lt;/P&gt;&lt;P&gt;/*&amp;nbsp;Creation of List for All&amp;nbsp;First Time&amp;nbsp;Reporters for&amp;nbsp;Ref MM=03 reports for this Group Number;*/---------&amp;gt;I Need This Part.&lt;/P&gt;&lt;P&gt;proc sql;&lt;BR /&gt;&amp;nbsp; create table 'WORK.FILTER_FOR_REGISTRY_CURRENT';&lt;BR /&gt;&amp;nbsp; select a.* from WORK.FILTER_FOR_REGISTRY_CURRENT a;&lt;BR /&gt;&amp;nbsp; create table 'Table micro.microdata_current b';&lt;BR /&gt;&amp;nbsp; select b.* from micro.microdata_current b;&lt;/P&gt;&lt;P&gt;quit;/*&amp;nbsp;Creation of List for All&amp;nbsp;First Time&amp;nbsp;Reporters for&amp;nbsp;Ref MM=03 reports for this Group Number;*/---------&amp;gt;I Need This Part.&lt;/P&gt;</description>
      <pubDate>Tue, 16 Apr 2019 18:13:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-do-create-a-table-that-compares-across-three-or-more/m-p/551494#M74564</guid>
      <dc:creator>StephenPM33</dc:creator>
      <dc:date>2019-04-16T18:13:56Z</dc:date>
    </item>
    <item>
      <title>Re: How do I create a table that compares across three or more datasets using Proc SQL?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-do-create-a-table-that-compares-across-three-or-more/m-p/551502#M74565</link>
      <description>&lt;P&gt;You don't want three identical SQL extracts, one for each month, that have to be combined. You can have one extract containing all three months, and then you don't have to combine three data sets somehow. Then, as I said, PROC SUMMARY or the equivalent PROC SQL will show which months have data for a given variable, and which months do not.&lt;/P&gt;</description>
      <pubDate>Tue, 16 Apr 2019 18:40:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-do-create-a-table-that-compares-across-three-or-more/m-p/551502#M74565</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-04-16T18:40:43Z</dc:date>
    </item>
    <item>
      <title>Re: How do I create a table that compares across three or more datasets using Proc SQL?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-do-create-a-table-that-compares-across-three-or-more/m-p/552376#M74599</link>
      <description>&lt;P&gt;This isn't difficult in SQL. Query your March data, then LEFT JOIN to your FEB and JAN data. If the report number is missing from the latter two than means they don't exist in those months. It should work something like this. If reportid_feb or reportid_jan return as missing values they don't exist in those tables.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
  create want as 
  select  A.*
            ,B.reportid as reportid_feb
            ,C.reportid as reportid_jan
  from Mar as A
  left join Feb as B
  on A.reportid = B.reportid
  left join Jan as C
  on A.reportid = C.reportid
  ;
quit; &lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 18 Apr 2019 23:45:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-do-create-a-table-that-compares-across-three-or-more/m-p/552376#M74599</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2019-04-18T23:45:12Z</dc:date>
    </item>
  </channel>
</rss>

