<?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: Creating a list from two; some IDs match between the two lists and some don't in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-list-from-two-some-IDs-match-between-the-two-lists/m-p/183997#M34941</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If the IDS match between lists, will the corresponding information, ie school name, street address automatically match as well?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If not, how do you want to deal with that? If using the second file is fine the solution above is appropriate. If you want the first file, flip the data sets on the update statement. If its some other logic you'll need different code.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 17 Jul 2014 20:11:26 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2014-07-17T20:11:26Z</dc:date>
    <item>
      <title>Creating a list from two; some IDs match between the two lists and some don't</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-list-from-two-some-IDs-match-between-the-two-lists/m-p/183993#M34937</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;G'd a y.&amp;nbsp; I need to create a single list from two separate lists. One list has &amp;gt;10,000 observations; the other has a couple thousand.&lt;/P&gt;&lt;P&gt;Both lists have 7 digit character ID#s (I will list as single digit ID# below to make it easier to understand) . Some IDs match and some don't between the two lists.&lt;/P&gt;&lt;P&gt;I'd like to keep the ID, Name, Phys Street, PhysCity, PhysZip, and Email for the final list.&amp;nbsp;&amp;nbsp;&amp;nbsp; How would I get a final list where each ID is listed once?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;List One&lt;/P&gt;&lt;P&gt;ID&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SchoolName&amp;nbsp;&amp;nbsp; PhysStreet PhysCity PhsZip&amp;nbsp;&amp;nbsp; Email&amp;nbsp; &lt;/P&gt;&lt;P&gt;1&lt;/P&gt;&lt;P&gt;2&lt;/P&gt;&lt;P&gt;3&lt;/P&gt;&lt;P&gt;4&lt;/P&gt;&lt;P&gt;5&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;List Two&lt;/P&gt;&lt;P&gt;ID&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SchoolName&amp;nbsp;&amp;nbsp; PhysStreet PhysCity PhsZip&amp;nbsp;&amp;nbsp; Email &lt;/P&gt;&lt;P&gt;2&lt;/P&gt;&lt;P&gt;4&lt;/P&gt;&lt;P&gt;5&lt;/P&gt;&lt;P&gt;9&lt;/P&gt;&lt;P&gt;8&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any help you can give is much appreciated!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 Jul 2014 18:54:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-a-list-from-two-some-IDs-match-between-the-two-lists/m-p/183993#M34937</guid>
      <dc:creator>jcis7</dc:creator>
      <dc:date>2014-07-17T18:54:24Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a list from two; some IDs match between the two lists and some don't</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-list-from-two-some-IDs-match-between-the-two-lists/m-p/183994#M34938</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;proc sort data=one;&lt;BR /&gt;by id;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sort data=two;&lt;BR /&gt;by id;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want;&lt;BR /&gt;update one two;&lt;BR /&gt;by id;&lt;BR /&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 Jul 2014 19:18:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-a-list-from-two-some-IDs-match-between-the-two-lists/m-p/183994#M34938</guid>
      <dc:creator>stat_sas</dc:creator>
      <dc:date>2014-07-17T19:18:51Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a list from two; some IDs match between the two lists and some don't</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-list-from-two-some-IDs-match-between-the-two-lists/m-p/183995#M34939</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Appreciate your response! Correct me if I'm wrong, but I thought the update statetment updates values in dataset one with the values in dataset two that match but doesn't add the observations from dataset two into dataset one that don't match?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Final List&lt;/P&gt;&lt;P&gt;ID&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SchoolName&amp;nbsp;&amp;nbsp; PhysStreet PhysCity PhsZip&amp;nbsp;&amp;nbsp; Email &lt;/P&gt;&lt;P&gt;1&lt;/P&gt;&lt;P&gt;2&lt;/P&gt;&lt;P&gt;3&lt;/P&gt;&lt;P&gt;4&lt;/P&gt;&lt;P&gt;5&lt;/P&gt;&lt;P&gt;9&lt;/P&gt;&lt;P&gt;8&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 Jul 2014 19:29:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-a-list-from-two-some-IDs-match-between-the-two-lists/m-p/183995#M34939</guid>
      <dc:creator>jcis7</dc:creator>
      <dc:date>2014-07-17T19:29:53Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a list from two; some IDs match between the two lists and some don't</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-list-from-two-some-IDs-match-between-the-two-lists/m-p/183996#M34940</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It does both. Observations in list one will be updated across the variables with the values of list two based on common ids and new ids from list two will also be added to list one to make it final list. I am assuming that ids are unique in both list one and list two.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 Jul 2014 19:38:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-a-list-from-two-some-IDs-match-between-the-two-lists/m-p/183996#M34940</guid>
      <dc:creator>stat_sas</dc:creator>
      <dc:date>2014-07-17T19:38:42Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a list from two; some IDs match between the two lists and some don't</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-list-from-two-some-IDs-match-between-the-two-lists/m-p/183997#M34941</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If the IDS match between lists, will the corresponding information, ie school name, street address automatically match as well?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If not, how do you want to deal with that? If using the second file is fine the solution above is appropriate. If you want the first file, flip the data sets on the update statement. If its some other logic you'll need different code.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 Jul 2014 20:11:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-a-list-from-two-some-IDs-match-between-the-two-lists/m-p/183997#M34941</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2014-07-17T20:11:26Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a list from two; some IDs match between the two lists and some don't</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-list-from-two-some-IDs-match-between-the-two-lists/m-p/183998#M34942</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Good point.&amp;nbsp; The addresses most likely will match between the two lists. How can you tell if they don't match (i.e, keep the ones in the final list that have the same ID but different addresses)?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 Jul 2014 20:50:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-a-list-from-two-some-IDs-match-between-the-two-lists/m-p/183998#M34942</guid>
      <dc:creator>jcis7</dc:creator>
      <dc:date>2014-07-17T20:50:49Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a list from two; some IDs match between the two lists and some don't</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-list-from-two-some-IDs-match-between-the-two-lists/m-p/183999#M34943</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Appreciate you helping me understand the UPDATE statement better!!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 Jul 2014 20:54:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-a-list-from-two-some-IDs-match-between-the-two-lists/m-p/183999#M34943</guid>
      <dc:creator>jcis7</dc:creator>
      <dc:date>2014-07-17T20:54:14Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a list from two; some IDs match between the two lists and some don't</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-list-from-two-some-IDs-match-between-the-two-lists/m-p/184000#M34944</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If this is manually entered data you'll also have issue with the address, where one person spells out street and the other uses st.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would append and take a look and see if the multiples have differences first to determine what needs to be done to clean the data. The check dataset below will be all ID's with multiple records.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data temp;&lt;/P&gt;&lt;P&gt;set one two indsname=source;&lt;/P&gt;&lt;P&gt;DSET=source;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sort data=temp; by id schoolname phystreet;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data check;&lt;/P&gt;&lt;P&gt;set temp;&lt;/P&gt;&lt;P&gt;by id;&lt;/P&gt;&lt;P&gt;if first.id ne last.id;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 Jul 2014 20:56:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-a-list-from-two-some-IDs-match-between-the-two-lists/m-p/184000#M34944</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2014-07-17T20:56:59Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a list from two; some IDs match between the two lists and some don't</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-list-from-two-some-IDs-match-between-the-two-lists/m-p/184001#M34945</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Great -- appreciate you helping understand how to check the dataset!!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 Jul 2014 23:15:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-a-list-from-two-some-IDs-match-between-the-two-lists/m-p/184001#M34945</guid>
      <dc:creator>jcis7</dc:creator>
      <dc:date>2014-07-17T23:15:36Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a list from two; some IDs match between the two lists and some don't</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-list-from-two-some-IDs-match-between-the-two-lists/m-p/184002#M34946</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If I understood what you mean.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;data a;
 set sashelp.class;
 id+1;
run;
data b;
 set sashelp.class end=last;
 id+1; output;
 if last then do;id+1;name='Arthur.T'; output;end;
run;

data once;
 set a b;
 by id;
if first.id and last.id ;
run;

&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Xia Keshan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Jul 2014 16:30:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-a-list-from-two-some-IDs-match-between-the-two-lists/m-p/184002#M34946</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2014-07-18T16:30:59Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a list from two; some IDs match between the two lists and some don't</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-list-from-two-some-IDs-match-between-the-two-lists/m-p/184003#M34947</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE __jive_macro_name="quote" class="jive_text_macro jive_macro_quote"&gt;
&lt;P&gt;Ksharp wrote:&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;If I understood what you mean.&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;PRE&gt;data a;
 set sashelp.class;
 id+1;
run;
data b;
 set sashelp.class end=last;
 id+1; output;
 if last then do;id+1;name='Arthur.T'; output;end;
run;

data once;
 set a b;
 by id;
if first.id and last.id ;
run;

&lt;/PRE&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;Xia Keshan&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;What does the following code refer to or do?&amp;nbsp; name='Arthur.T';&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Jul 2014 21:53:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-a-list-from-two-some-IDs-match-between-the-two-lists/m-p/184003#M34947</guid>
      <dc:creator>jcis7</dc:creator>
      <dc:date>2014-07-22T21:53:51Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a list from two; some IDs match between the two lists and some don't</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-list-from-two-some-IDs-match-between-the-two-lists/m-p/184004#M34948</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It adds a record in to data set B, with the name set as Arthur.T, this record would not be data set A.&lt;/P&gt;&lt;P&gt;It's a way of simulating your data.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Jul 2014 00:24:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-a-list-from-two-some-IDs-match-between-the-two-lists/m-p/184004#M34948</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2014-07-23T00:24:59Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a list from two; some IDs match between the two lists and some don't</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-list-from-two-some-IDs-match-between-the-two-lists/m-p/184005#M34949</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks. Reeza .&amp;nbsp;&amp;nbsp; Yes. I just make a dummy table to simulate your data .&lt;/P&gt;&lt;P&gt;Reeza , You gonna surpass Arthur.T to be number one of sas user list . Congratulations !&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Xia Keshan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Jul 2014 12:16:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-a-list-from-two-some-IDs-match-between-the-two-lists/m-p/184005#M34949</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2014-07-23T12:16:24Z</dc:date>
    </item>
  </channel>
</rss>

