<?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: Combining three datasets in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Combining-three-datasets/m-p/617952#M181174</link>
    <description>&lt;P&gt;I ran the code and did not receive any errors in the log but the values were extdt are all&amp;nbsp; missing.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 16 Jan 2020 22:27:58 GMT</pubDate>
    <dc:creator>luvscandy27</dc:creator>
    <dc:date>2020-01-16T22:27:58Z</dc:date>
    <item>
      <title>Combining three datasets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Combining-three-datasets/m-p/617930#M181160</link>
      <description>&lt;P&gt;I have the following three datasets which all need to be combined together.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Data 1&lt;BR /&gt;Filedate ID Status monyear birdtype&lt;BR /&gt;1/25/2018 100 y JAN2018 Sparrow&lt;BR /&gt;2/28/2018 200 y FEB2018 robin&lt;BR /&gt;3/15/2018 300 n MAR2018 bluebird&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Data 2&lt;BR /&gt;birdtype monyear Population&lt;BR /&gt;Sparrow JAN2018 100&lt;BR /&gt;robin FEB2018 150&lt;BR /&gt;bluebird MAR2018 150&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Data 3&lt;BR /&gt;reportorder monyear startdt endddt extdt&lt;BR /&gt;1 JAN2018 1/31/2016 1/31/2017 4/30/2018&lt;BR /&gt;2 FEB2018 2/29/2016 2/28/2017 5/31/2018&lt;BR /&gt;3 MAR2018 4/30/2016 4/30/2017 7/31/2018&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The datasets data1 and data 2 I merge&amp;nbsp; together by birdtype and monyear using the following code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data one_two_combined;&lt;BR /&gt;merge data1 data2;&lt;BR /&gt;by birdtype monyear;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;then I combine dataset one_two_combined with data 3 using the following code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data all_combined;&lt;BR /&gt;merge one_two_combined data3;&lt;BR /&gt;by monyear;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;the codes above work but I would like to combine all the datasets in one step. Dataset one and two must be combined&lt;BR /&gt;by the birdtype and monyear and dataset three does not have a birdtype column so when I tried using the code below it&lt;BR /&gt;does not work.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data want;&lt;BR /&gt;merge data1 data2 data3;&lt;BR /&gt;by birdtype monyear;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any suggestions on how I can merge all three datasets in one step?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 16 Jan 2020 20:57:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Combining-three-datasets/m-p/617930#M181160</guid>
      <dc:creator>luvscandy27</dc:creator>
      <dc:date>2020-01-16T20:57:04Z</dc:date>
    </item>
    <item>
      <title>Re: Combining three datasets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Combining-three-datasets/m-p/617931#M181161</link>
      <description>&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;so when I tried using the code below it&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;does not work.&lt;/SPAN&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;BR /&gt;This does not convey any information that is useful in solving the problem. What did not work? Did you get an error in the LOG? Did you get the wrong result. Explain in detail.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 16 Jan 2020 20:59:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Combining-three-datasets/m-p/617931#M181161</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-01-16T20:59:52Z</dc:date>
    </item>
    <item>
      <title>Re: Combining three datasets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Combining-three-datasets/m-p/617932#M181162</link>
      <description>&lt;P&gt;SAS will not allow me to merge all three datasets at one time. I get the error that dataset 3 does not have a birdtype variable.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 16 Jan 2020 21:07:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Combining-three-datasets/m-p/617932#M181162</guid>
      <dc:creator>luvscandy27</dc:creator>
      <dc:date>2020-01-16T21:07:23Z</dc:date>
    </item>
    <item>
      <title>Re: Combining three datasets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Combining-three-datasets/m-p/617937#M181166</link>
      <description>&lt;P&gt;One Way :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data Data1;
input Filedate anydtdte. ID Status $ monyear $ birdtype $;
cards;
1/25/2018 100 y JAN2018 Sparrow
2/28/2018 200 y FEB2018 robin
3/15/2018 300 n MAR2018 bluebird
;
run;

Data Data2;
input birdtype $ monyear $ Population;
cards;
Sparrow JAN2018 100
robin FEB2018 150
bluebird MAR2018 150
run;
 
data Data3;
input reportorder  monyear $ (startdt endddt extdt) (anydtdte.);
cards;
1 JAN2018 1/31/2016 01/31/2017 04/30/2018
2 FEB2018 2/29/2016 02/28/2017 05/31/2018
3 MAR2018 4/30/2016 04/30/2017 07/31/2018
;
run;


data want;
length birdtype $15. Population reportorder startdt endddt extdt 8.;
	if _n_=1 then do;
		declare hash h1(dataset:"Data2");
		h1.definekey('birdtype','monyear');
		h1.definedata(all:'y');
		h1.definedone();

		declare hash h2(dataset:"Data3");
		h2.definekey('monyear');
		h2.definedata(all:'y');
		h2.definedone();
		call missing(birdtype,Population,reportorder,startdt,endddt,extdt);
	end;
	set Data1;

	rc1=h1.find();
	rc2=h2.find();

	drop rc1 rc2;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 16 Jan 2020 21:28:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Combining-three-datasets/m-p/617937#M181166</guid>
      <dc:creator>r_behata</dc:creator>
      <dc:date>2020-01-16T21:28:13Z</dc:date>
    </item>
    <item>
      <title>Re: Combining three datasets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Combining-three-datasets/m-p/617939#M181167</link>
      <description>&lt;P&gt;Thank you. I am very new to the hash object if at all possible&amp;nbsp; could you please explain the code you have provided?&lt;/P&gt;</description>
      <pubDate>Thu, 16 Jan 2020 21:40:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Combining-three-datasets/m-p/617939#M181167</guid>
      <dc:creator>luvscandy27</dc:creator>
      <dc:date>2020-01-16T21:40:47Z</dc:date>
    </item>
    <item>
      <title>Re: Combining three datasets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Combining-three-datasets/m-p/617952#M181174</link>
      <description>&lt;P&gt;I ran the code and did not receive any errors in the log but the values were extdt are all&amp;nbsp; missing.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 16 Jan 2020 22:27:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Combining-three-datasets/m-p/617952#M181174</guid>
      <dc:creator>luvscandy27</dc:creator>
      <dc:date>2020-01-16T22:27:58Z</dc:date>
    </item>
  </channel>
</rss>

