<?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: Array to search through multiple data sets in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Array-to-search-through-multiple-data-sets/m-p/612476#M178726</link>
    <description>&lt;P&gt;This worked well and is simple, thank you!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 17 Dec 2019 17:47:12 GMT</pubDate>
    <dc:creator>jmmedina25</dc:creator>
    <dc:date>2019-12-17T17:47:12Z</dc:date>
    <item>
      <title>Array to search through multiple data sets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Array-to-search-through-multiple-data-sets/m-p/612442#M178711</link>
      <description>&lt;P&gt;Hello,&amp;nbsp; i have 12 datasets that have data for each month of the year and I'd like to search for the data for 3 people within all data and produce a stacked dataset of all data at the end containing all data for these people in the year.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The data sets are labeled as such:&amp;nbsp; Data201910 , Data201911, Data201912, et. The last two digits represent the month&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need to pull data for person 1, 2, and 3.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How would I make an array to do this quickly rather than querying each data set?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 17 Dec 2019 16:23:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Array-to-search-through-multiple-data-sets/m-p/612442#M178711</guid>
      <dc:creator>jmmedina25</dc:creator>
      <dc:date>2019-12-17T16:23:10Z</dc:date>
    </item>
    <item>
      <title>Re: Array to search through multiple data sets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Array-to-search-through-multiple-data-sets/m-p/612451#M178716</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/261072"&gt;@jmmedina25&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;According to your description, array seems not to be the right solution, as array can loop through multiple variables but not datasets.&lt;/P&gt;
&lt;P&gt;I believe you nee a macro to make this repetitive task.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have written the below code. Please adapt the WHERE statement and test it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
/*UNTESTED CODE*/
%macro _search;

	%do i=1 %to 9;
	
		data want&amp;amp;i;
			set Data20190&amp;amp;i;
			where ID in (1,2,3); /*to be adapted according to your variables*/	
		run;
	%end;
		
	%do i=10 %to 12;
		data want&amp;amp;i;
			set Data2019&amp;amp;i;
			where ID in (1,2,3); /*to be adapted according to your variables*/	
		run;		
	%end;
		
%mend;

%_search;

data want;
	set want:;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 17 Dec 2019 16:42:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Array-to-search-through-multiple-data-sets/m-p/612451#M178716</guid>
      <dc:creator>ed_sas_member</dc:creator>
      <dc:date>2019-12-17T16:42:46Z</dc:date>
    </item>
    <item>
      <title>Re: Array to search through multiple data sets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Array-to-search-through-multiple-data-sets/m-p/612452#M178717</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/261072"&gt;@jmmedina25&lt;/a&gt;&amp;nbsp; Since your datasets have an easy naming sequence, all you probably need is&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
set Data201901-Data201912;
where person in (1,2,3);
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 17 Dec 2019 16:48:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Array-to-search-through-multiple-data-sets/m-p/612452#M178717</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2019-12-17T16:48:14Z</dc:date>
    </item>
    <item>
      <title>Re: Array to search through multiple data sets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Array-to-search-through-multiple-data-sets/m-p/612476#M178726</link>
      <description>&lt;P&gt;This worked well and is simple, thank you!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 17 Dec 2019 17:47:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Array-to-search-through-multiple-data-sets/m-p/612476#M178726</guid>
      <dc:creator>jmmedina25</dc:creator>
      <dc:date>2019-12-17T17:47:12Z</dc:date>
    </item>
    <item>
      <title>Re: Array to search through multiple data sets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Array-to-search-through-multiple-data-sets/m-p/612480#M178729</link>
      <description>&lt;P&gt;You're welcome&amp;nbsp;&lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 17 Dec 2019 17:54:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Array-to-search-through-multiple-data-sets/m-p/612480#M178729</guid>
      <dc:creator>ed_sas_member</dc:creator>
      <dc:date>2019-12-17T17:54:42Z</dc:date>
    </item>
  </channel>
</rss>

