<?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: Assigning ID code stored in External dataset file? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Assigning-ID-code-stored-in-External-dataset-file/m-p/712838#M219834</link>
    <description>A left or right join depending on how you order the tables I suppose, if only one table has duplicates you need to merge on multiple variables or remove the duplicates ahead of time. I would assume you'd be merging by name/city/year which doesn't have duplicates.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Examples on how to merge are here&lt;BR /&gt;&lt;A href="https://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.5&amp;amp;docsetId=lrcon&amp;amp;docsetTarget=n1tgk0uanvisvon1r26lc036k0w7.htm&amp;amp;locale=en#n1ctxgi9fb8kjhn1ni3dbuecjuno" target="_blank"&gt;https://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.5&amp;amp;docsetId=lrcon&amp;amp;docsetTarget=n1tgk0uanvisvon1r26lc036k0w7.htm&amp;amp;locale=en#n1ctxgi9fb8kjhn1ni3dbuecjuno&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Assuming both data sets have been sorted by name, city and year.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;data want;&lt;BR /&gt;merge SASdatasetName (in=source1) ExcelFileName (in=source2);&lt;BR /&gt;by name city year;&lt;BR /&gt;if source1;&lt;BR /&gt;&lt;BR /&gt;run;&lt;BR /&gt;</description>
    <pubDate>Wed, 20 Jan 2021 19:05:22 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2021-01-20T19:05:22Z</dc:date>
    <item>
      <title>Assigning ID code stored in External dataset file?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Assigning-ID-code-stored-in-External-dataset-file/m-p/710815#M218881</link>
      <description>&lt;P&gt;I have a dataset I want to assign ID values based on what's stored in an "master" excel sheet I've been keeping for the relevant variables.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In this master list, variables are: year, Facility_name, facility_city, and the ID number I assigned myself.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In the dataset I'm working with, I basically want SAS to read each row and, if it matches the year, name, and city, to assign the ID that's associated with it.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;SAS Dataset (have):&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;
&lt;TABLE border="1" width="100.15673741650387%"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="12.5%" height="28px"&gt;&lt;STRONG&gt;Customer&lt;/STRONG&gt;&lt;/TD&gt;
&lt;TD width="12.5%"&gt;&lt;STRONG&gt;Year&lt;/STRONG&gt;&lt;/TD&gt;
&lt;TD width="25%" height="28px"&gt;&lt;STRONG&gt;Facility_name&lt;/STRONG&gt;&lt;/TD&gt;
&lt;TD width="25%" height="28px"&gt;&lt;STRONG&gt;Facility_City&lt;/STRONG&gt;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;David&lt;/TD&gt;
&lt;TD&gt;2018&lt;/TD&gt;
&lt;TD&gt;Appleville Grocery&lt;/TD&gt;
&lt;TD&gt;Smallville&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="12.5%" height="28px"&gt;Jane&lt;/TD&gt;
&lt;TD width="12.5%"&gt;2018&lt;/TD&gt;
&lt;TD width="25%" height="28px"&gt;Appleville Grocery&lt;/TD&gt;
&lt;TD width="25%" height="28px"&gt;Smallville&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="12.5%" height="28px"&gt;
&lt;P&gt;John&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="12.5%"&gt;
&lt;P&gt;2018&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="25%" height="28px"&gt;Appleville Grocery&lt;/TD&gt;
&lt;TD width="25%" height="28px"&gt;Large Town&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="12.5%" height="28px"&gt;Kelly&lt;/TD&gt;
&lt;TD width="12.5%"&gt;2017&lt;/TD&gt;
&lt;TD width="25%" height="28px"&gt;Sunnyille Mall&lt;/TD&gt;
&lt;TD width="25%" height="28px"&gt;Sunnyville&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Master list, Excel file:&lt;/STRONG&gt;&lt;/P&gt;
&lt;TABLE border="1" width="95.40322786136916%"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="39.7410358565737%" height="28px"&gt;&lt;STRONG&gt;Facility_name&lt;/STRONG&gt;&lt;/TD&gt;
&lt;TD width="1.9920318725099602%" height="28px"&gt;&lt;STRONG&gt;Facility_City&lt;/STRONG&gt;&lt;/TD&gt;
&lt;TD width="1.9920318725099602%" height="28px"&gt;&lt;STRONG&gt;Year&lt;/STRONG&gt;&lt;/TD&gt;
&lt;TD width="12.5%" height="28px"&gt;&lt;STRONG&gt;ID&lt;/STRONG&gt;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="39.7410358565737%" height="28px"&gt;Appleville Grocery&lt;/TD&gt;
&lt;TD width="1.9920318725099602%" height="28px"&gt;Smallville&lt;/TD&gt;
&lt;TD width="1.9920318725099602%" height="28px"&gt;2018&lt;/TD&gt;
&lt;TD width="12.5%" height="28px"&gt;1&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="39.7410358565737%" height="28px"&gt;Appleville Grocery&lt;/TD&gt;
&lt;TD width="1.9920318725099602%" height="28px"&gt;Large Town&lt;/TD&gt;
&lt;TD width="1.9920318725099602%" height="28px"&gt;2018&lt;/TD&gt;
&lt;TD width="12.5%" height="28px"&gt;2&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;Sunnyville Mall - West&lt;/TD&gt;
&lt;TD&gt;Sunnyvale&lt;/TD&gt;
&lt;TD&gt;2018&lt;/TD&gt;
&lt;TD&gt;3&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="39.7410358565737%" height="28px"&gt;Sunnyille Mall&lt;/TD&gt;
&lt;TD width="1.9920318725099602%" height="28px"&gt;Sunnyvale&lt;/TD&gt;
&lt;TD width="1.9920318725099602%" height="28px"&gt;2017&lt;/TD&gt;
&lt;TD width="12.5%" height="28px"&gt;4&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Final Dataset (want):&lt;/STRONG&gt;&lt;/P&gt;
&lt;TABLE border="1" width="641.25px"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="104px" height="28px"&gt;&lt;STRONG&gt;Customer&lt;/STRONG&gt;&lt;/TD&gt;
&lt;TD width="106.667px" height="28px"&gt;&lt;STRONG&gt;Year&lt;/STRONG&gt;&lt;/TD&gt;
&lt;TD width="213.333px" height="28px"&gt;&lt;STRONG&gt;Facility_name&lt;/STRONG&gt;&lt;/TD&gt;
&lt;TD width="106.667px" height="28px"&gt;&lt;STRONG&gt;Facility_City&lt;/STRONG&gt;&lt;/TD&gt;
&lt;TD width="108px" height="28px"&gt;&lt;STRONG&gt;ID&lt;/STRONG&gt;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="104px" height="28px"&gt;David&lt;/TD&gt;
&lt;TD width="106.667px" height="28px"&gt;2018&lt;/TD&gt;
&lt;TD width="213.333px" height="28px"&gt;Appleville Grocery&lt;/TD&gt;
&lt;TD width="106.667px" height="28px"&gt;Smallville&lt;/TD&gt;
&lt;TD width="108px" height="28px"&gt;1&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="104px" height="28px"&gt;Jane&lt;/TD&gt;
&lt;TD width="106.667px" height="28px"&gt;2018&lt;/TD&gt;
&lt;TD width="213.333px" height="28px"&gt;Appleville Grocery&lt;/TD&gt;
&lt;TD width="106.667px" height="28px"&gt;Smallville&lt;/TD&gt;
&lt;TD width="108px" height="28px"&gt;1&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="104px" height="28px"&gt;
&lt;P&gt;John&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="106.667px" height="28px"&gt;
&lt;P&gt;2018&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="213.333px" height="28px"&gt;Appleville Grocery&lt;/TD&gt;
&lt;TD width="106.667px" height="28px"&gt;Large Town&lt;/TD&gt;
&lt;TD width="108px" height="28px"&gt;2&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="104px" height="28px"&gt;Kelly&lt;/TD&gt;
&lt;TD width="106.667px" height="28px"&gt;2017&lt;/TD&gt;
&lt;TD width="213.333px" height="28px"&gt;Sunnyille Mall&lt;/TD&gt;
&lt;TD width="106.667px" height="28px"&gt;Sunnyvale&lt;/TD&gt;
&lt;TD width="108px" height="28px"&gt;4&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Jan 2021 14:58:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Assigning-ID-code-stored-in-External-dataset-file/m-p/710815#M218881</guid>
      <dc:creator>SAS93</dc:creator>
      <dc:date>2021-01-12T14:58:06Z</dc:date>
    </item>
    <item>
      <title>Re: Assigning ID code stored in External dataset file?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Assigning-ID-code-stored-in-External-dataset-file/m-p/710836#M218890</link>
      <description>Bring your second data set into SAS via PROC IMPORT and "apply it" in a merge or a format. If the join is on multiple values such as facility name, city and year then I'd use a join. If it's on a single field I'd use PROC FORMAT.</description>
      <pubDate>Tue, 12 Jan 2021 15:49:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Assigning-ID-code-stored-in-External-dataset-file/m-p/710836#M218890</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-01-12T15:49:49Z</dc:date>
    </item>
    <item>
      <title>Re: Assigning ID code stored in External dataset file?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Assigning-ID-code-stored-in-External-dataset-file/m-p/712805#M219826</link>
      <description>&lt;P&gt;What kind of join would it be using Proc SQL? I'm uncertain exactly how to "apply" one dataset that's smaller to another that has repeated values, if that makes sense.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Jan 2021 17:57:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Assigning-ID-code-stored-in-External-dataset-file/m-p/712805#M219826</guid>
      <dc:creator>SAS93</dc:creator>
      <dc:date>2021-01-20T17:57:00Z</dc:date>
    </item>
    <item>
      <title>Re: Assigning ID code stored in External dataset file?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Assigning-ID-code-stored-in-External-dataset-file/m-p/712838#M219834</link>
      <description>A left or right join depending on how you order the tables I suppose, if only one table has duplicates you need to merge on multiple variables or remove the duplicates ahead of time. I would assume you'd be merging by name/city/year which doesn't have duplicates.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Examples on how to merge are here&lt;BR /&gt;&lt;A href="https://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.5&amp;amp;docsetId=lrcon&amp;amp;docsetTarget=n1tgk0uanvisvon1r26lc036k0w7.htm&amp;amp;locale=en#n1ctxgi9fb8kjhn1ni3dbuecjuno" target="_blank"&gt;https://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.5&amp;amp;docsetId=lrcon&amp;amp;docsetTarget=n1tgk0uanvisvon1r26lc036k0w7.htm&amp;amp;locale=en#n1ctxgi9fb8kjhn1ni3dbuecjuno&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Assuming both data sets have been sorted by name, city and year.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;data want;&lt;BR /&gt;merge SASdatasetName (in=source1) ExcelFileName (in=source2);&lt;BR /&gt;by name city year;&lt;BR /&gt;if source1;&lt;BR /&gt;&lt;BR /&gt;run;&lt;BR /&gt;</description>
      <pubDate>Wed, 20 Jan 2021 19:05:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Assigning-ID-code-stored-in-External-dataset-file/m-p/712838#M219834</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-01-20T19:05:22Z</dc:date>
    </item>
  </channel>
</rss>

