<?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: Combine Two Tables with data step in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Combine-Two-Tables-with-data-step/m-p/493882#M130037</link>
    <description>&lt;P&gt;Do something like this (just made some data up)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data Person;
input PersonID FirstName $ LastName $;
datalines;
1 Peter Smith
2 Otto Burch
3 Paul Johnson
4 William Jones
5 Allan Brown
;

data Address;
input AddressID PersonID City $ State $20.;
datalines;
72 1 Houston Texas
44 3 Miami Florida
87 5 Seattle Washington
;

proc sort data=Person; by PersonID; run;
proc sort data=Address; by PersonID; run;

data want(drop=PersonID AddressID);
   merge Person(in=p) Address;
   by PersonID;
   if p;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Sun, 09 Sep 2018 10:15:25 GMT</pubDate>
    <dc:creator>PeterClemmensen</dc:creator>
    <dc:date>2018-09-09T10:15:25Z</dc:date>
    <item>
      <title>Combine Two Tables with data step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Combine-Two-Tables-with-data-step/m-p/493877#M130036</link>
      <description>&lt;P&gt;Table:&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;CODE&gt;Person&lt;/CODE&gt;&lt;/P&gt;&lt;PRE&gt;+-------------+---------+
| Column Name | Type    |
+-------------+---------+
| PersonId    | int     |
| FirstName   | varchar |
| LastName    | varchar |
+-------------+---------+
PersonId is the primary key column for this table.&lt;/PRE&gt;&lt;P&gt;Table:&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;CODE&gt;Address&lt;/CODE&gt;&lt;/P&gt;&lt;PRE&gt;+-------------+---------+
| Column Name | Type    |
+-------------+---------+
| AddressId   | int     |
| PersonId    | int     |
| City        | varchar |
| State       | varchar |
+-------------+---------+
AddressId is the primary key column for this table.&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Use data step for a report that provides the following information for each person in the Person table, regardless if there is an address for each of those people:&lt;/P&gt;&lt;PRE&gt;FirstName, LastName, City, State&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 09 Sep 2018 07:43:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Combine-Two-Tables-with-data-step/m-p/493877#M130036</guid>
      <dc:creator>ccnky123</dc:creator>
      <dc:date>2018-09-09T07:43:46Z</dc:date>
    </item>
    <item>
      <title>Re: Combine Two Tables with data step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Combine-Two-Tables-with-data-step/m-p/493882#M130037</link>
      <description>&lt;P&gt;Do something like this (just made some data up)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data Person;
input PersonID FirstName $ LastName $;
datalines;
1 Peter Smith
2 Otto Burch
3 Paul Johnson
4 William Jones
5 Allan Brown
;

data Address;
input AddressID PersonID City $ State $20.;
datalines;
72 1 Houston Texas
44 3 Miami Florida
87 5 Seattle Washington
;

proc sort data=Person; by PersonID; run;
proc sort data=Address; by PersonID; run;

data want(drop=PersonID AddressID);
   merge Person(in=p) Address;
   by PersonID;
   if p;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 09 Sep 2018 10:15:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Combine-Two-Tables-with-data-step/m-p/493882#M130037</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2018-09-09T10:15:25Z</dc:date>
    </item>
  </channel>
</rss>

