<?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: Joining multiple datasets in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Joining-multiple-datasets/m-p/895297#M353718</link>
    <description>&lt;P&gt;Sounds like you may want something along the lines of&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data want;
    set 
        data2016 (keep=&amp;lt;your desired variables go here&amp;gt;)
        data2017 (keep=&amp;lt;your desired variables go here&amp;gt;)
        data2018 (keep=&amp;lt;your desired variables go here&amp;gt;)
   ;
run;
&lt;/PRE&gt;
&lt;P&gt;I would suggest keeping all the likely identification variables like hospital, patient and date of visit related stuff if you hadn't been planning on it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you're really lazy you could likely skip the KEEP as the default behavior would to include all of the variables from all the sets.&lt;/P&gt;
&lt;P&gt;Caveat: the variables really should have the same properties: numeric/character and length in all of the data sets.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 21 Sep 2023 16:12:28 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2023-09-21T16:12:28Z</dc:date>
    <item>
      <title>Joining multiple datasets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Joining-multiple-datasets/m-p/895286#M353711</link>
      <description>&lt;P&gt;Hello!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am working with healthcare data and have a dataset for each year of data. So, for example, the 2019 and 2020 datasets have all the same variables/variable names for their respective year.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need to combine/aggregate the 2016-2021 datasets but am having a hard time doing so, or rather, knowing the most succinct way to do so.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;There are about 10 or so variables I need to let SAS know are the equal to each other across the datasets.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Thu, 21 Sep 2023 15:19:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Joining-multiple-datasets/m-p/895286#M353711</guid>
      <dc:creator>steph_</dc:creator>
      <dc:date>2023-09-21T15:19:19Z</dc:date>
    </item>
    <item>
      <title>Re: Joining multiple datasets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Joining-multiple-datasets/m-p/895291#M353714</link>
      <description>&lt;P&gt;Can you please make up a small example for two years, showing the data for the two years and the desired result? The example doesn't have to have 10 variables, 3 would be fine. Data can be completely made up, as long as it illustrates the problem.&lt;/P&gt;</description>
      <pubDate>Thu, 21 Sep 2023 15:38:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Joining-multiple-datasets/m-p/895291#M353714</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-09-21T15:38:40Z</dc:date>
    </item>
    <item>
      <title>Re: Joining multiple datasets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Joining-multiple-datasets/m-p/895293#M353715</link>
      <description>&lt;P&gt;Example: I need to join the 2016 (made up of 100 hospitalizations), 2017 (made up of 200 hospitalizations), and 2018&amp;nbsp;(made up of 300 hospitalizations) datasets. I am looking at the diabetes, COPD, and CVD variables (which have the same variable name across the datasets).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So my end product/dataset would be 2016-2018 datasets combined with a total of 600 hospitalizations. After this new dataset was created, I would be able to run a proc freq statement by whether or not any of those 600 hospitalizations between 2016-2018 were for diabetes, COPD, or CVD.&lt;/P&gt;</description>
      <pubDate>Thu, 21 Sep 2023 15:53:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Joining-multiple-datasets/m-p/895293#M353715</guid>
      <dc:creator>steph_</dc:creator>
      <dc:date>2023-09-21T15:53:17Z</dc:date>
    </item>
    <item>
      <title>Re: Joining multiple datasets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Joining-multiple-datasets/m-p/895297#M353718</link>
      <description>&lt;P&gt;Sounds like you may want something along the lines of&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data want;
    set 
        data2016 (keep=&amp;lt;your desired variables go here&amp;gt;)
        data2017 (keep=&amp;lt;your desired variables go here&amp;gt;)
        data2018 (keep=&amp;lt;your desired variables go here&amp;gt;)
   ;
run;
&lt;/PRE&gt;
&lt;P&gt;I would suggest keeping all the likely identification variables like hospital, patient and date of visit related stuff if you hadn't been planning on it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you're really lazy you could likely skip the KEEP as the default behavior would to include all of the variables from all the sets.&lt;/P&gt;
&lt;P&gt;Caveat: the variables really should have the same properties: numeric/character and length in all of the data sets.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Sep 2023 16:12:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Joining-multiple-datasets/m-p/895297#M353718</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2023-09-21T16:12:28Z</dc:date>
    </item>
    <item>
      <title>Re: Joining multiple datasets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Joining-multiple-datasets/m-p/895298#M353719</link>
      <description>&lt;P&gt;Adding on to&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt;&amp;nbsp;answer.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You may need to rename some variables (RENAME option), and want to indicate which dataset it came from (INDSNAME option).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
length src source $50.;
    set 
        data2016 (keep=&amp;lt;your desired variables go here&amp;gt; rename=(oldname1=newname1 oldname2=newname2))
        data2017 (keep=&amp;lt;your desired variables go here&amp;gt;)
        data2018 (keep=&amp;lt;your desired variables go here&amp;gt;)
        INDSNAME = SRC;

Source = src;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 21 Sep 2023 16:16:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Joining-multiple-datasets/m-p/895298#M353719</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2023-09-21T16:16:53Z</dc:date>
    </item>
  </channel>
</rss>

