<?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: Reading multiple .sas7bdat files from folder and select only required datasets whenever we need in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Reading-multiple-sas7bdat-files-from-folder-and-select-only/m-p/513761#M138481</link>
    <description>&lt;P&gt;Like this?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;libname Z '/SAS/sas1/sas_sub1/all_datasets';
data WANT;
  set Z.AA Z.BB Z.CC %sysfunc(ifc(exist(Z.DD),Z.DD,));
run; &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 16 Nov 2018 02:15:00 GMT</pubDate>
    <dc:creator>ChrisNZ</dc:creator>
    <dc:date>2018-11-16T02:15:00Z</dc:date>
    <item>
      <title>Reading multiple .sas7bdat files from folder and select only required datasets whenever we need</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-multiple-sas7bdat-files-from-folder-and-select-only/m-p/513717#M138447</link>
      <description>Hi All,&lt;BR /&gt;&lt;BR /&gt;I have situation, In ALL_DATASETS folder I have three .sas7bdat files (AA, BB, CC) and I have to read all the files and join datasets from that folder. In the future, I may get one additional dataset (DD) or may not. But, the code should support both the scenarios. could someone help me in that.&lt;BR /&gt;Example: I have datasets in path " SAS/sas1/sas_sub1/all_datasets".&lt;BR /&gt;In that folder, I have&lt;BR /&gt;AA.sas7bdat&lt;BR /&gt;BB.sas7bdat&lt;BR /&gt;CC.sas7bdat&lt;BR /&gt;The dataset expecting will be named as DD.sas7bdat.&lt;BR /&gt;</description>
      <pubDate>Thu, 15 Nov 2018 23:36:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-multiple-sas7bdat-files-from-folder-and-select-only/m-p/513717#M138447</guid>
      <dc:creator>teja04</dc:creator>
      <dc:date>2018-11-15T23:36:32Z</dc:date>
    </item>
    <item>
      <title>Reading multiple .sas7bdat files from folder and select only required datasets whenever we need</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-multiple-sas7bdat-files-from-folder-and-select-only/m-p/513715#M138480</link>
      <description>Hi All,&lt;BR /&gt;&lt;BR /&gt;I have situation, In ALL_DATASETS folder I have three .sas7bdat files (AA, BB, CC) and I have to read all the files and join datasets from that folder. In the future, I may get one additional dataset (DD) or not. But, the code should support both the scenarios. could someone help me in that.&lt;BR /&gt;Example: I have datasets in path " SAS/sas1/sas_sub1/all_datasets".&lt;BR /&gt;In that folder, I have&lt;BR /&gt;AA.sas7bdat&lt;BR /&gt;BB.sas7bdat&lt;BR /&gt;CC.sas7bdat&lt;BR /&gt;The dataset expecting will be named as DD.sas7bdat.&lt;BR /&gt;</description>
      <pubDate>Thu, 15 Nov 2018 23:34:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-multiple-sas7bdat-files-from-folder-and-select-only/m-p/513715#M138480</guid>
      <dc:creator>teja04</dc:creator>
      <dc:date>2018-11-15T23:34:42Z</dc:date>
    </item>
    <item>
      <title>Re: Reading multiple .sas7bdat files from folder and select only required datasets whenever we need</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-multiple-sas7bdat-files-from-folder-and-select-only/m-p/513722#M138450</link>
      <description>&lt;P&gt;You have to be more specific than "Join datasets from that folder". What kind of join?&lt;/P&gt;</description>
      <pubDate>Thu, 15 Nov 2018 23:46:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-multiple-sas7bdat-files-from-folder-and-select-only/m-p/513722#M138450</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2018-11-15T23:46:21Z</dc:date>
    </item>
    <item>
      <title>Re: Reading multiple .sas7bdat files from folder and select only required datasets whenever we need</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-multiple-sas7bdat-files-from-folder-and-select-only/m-p/513731#M138453</link>
      <description>I want to append the datasets.</description>
      <pubDate>Thu, 15 Nov 2018 23:55:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-multiple-sas7bdat-files-from-folder-and-select-only/m-p/513731#M138453</guid>
      <dc:creator>teja04</dc:creator>
      <dc:date>2018-11-15T23:55:35Z</dc:date>
    </item>
    <item>
      <title>Re: Reading multiple .sas7bdat files from folder and select only required datasets whenever we need</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-multiple-sas7bdat-files-from-folder-and-select-only/m-p/513732#M138454</link>
      <description>Hi draycut,&lt;BR /&gt;&lt;BR /&gt;I want to append the datasets</description>
      <pubDate>Thu, 15 Nov 2018 23:58:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-multiple-sas7bdat-files-from-folder-and-select-only/m-p/513732#M138454</guid>
      <dc:creator>teja04</dc:creator>
      <dc:date>2018-11-15T23:58:46Z</dc:date>
    </item>
    <item>
      <title>Re: Reading multiple .sas7bdat files from folder and select only required datasets whenever we need</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-multiple-sas7bdat-files-from-folder-and-select-only/m-p/513741#M138458</link>
      <description>&lt;P&gt;The first thing would be to assign a LIBRARY to point to the folder location.&lt;/P&gt;
&lt;P&gt;Your example path looks incomplete you should add the bits at the front so that the path starts at a disc or mount point point but generally something like:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;libname mydata 'SAS/sas1/sas_sub1/all_datasets';&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Check the LOG for messages. If you do not see a successfully assigned result then the path needs to be modified as mentions.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The append can be done with that procedure assuming you have similar variables.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Proc append base=mydata.Alldata&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; data=mydata.AA;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;Proc append base=mydata.Alldata&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; data=mydata.BB;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;Note how the libname is used to address the data sets.&lt;/P&gt;
&lt;P&gt;Later to add other sets you just change the name of the set on the DATA= line to add it to the AllData set.&lt;/P&gt;
&lt;P&gt;The first time Alldata does not exist so the procedure creates it using the contents of mydata.AA to determine the number and types of variables.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If the sets to do not have the same variables this won't work because append will only add matching variables.&lt;/P&gt;</description>
      <pubDate>Fri, 16 Nov 2018 00:16:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-multiple-sas7bdat-files-from-folder-and-select-only/m-p/513741#M138458</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-11-16T00:16:33Z</dc:date>
    </item>
    <item>
      <title>Re: Reading multiple .sas7bdat files from folder and select only required datasets whenever we need</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-multiple-sas7bdat-files-from-folder-and-select-only/m-p/513754#M138464</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%let mystr =&lt;SPAN&gt;AA &lt;/SPAN&gt;&lt;SPAN&gt;BB &lt;/SPAN&gt;&lt;SPAN&gt;CC&lt;/SPAN&gt;;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;data want;&lt;BR /&gt;&amp;nbsp;set &amp;amp;mystr.;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Nov 2018 01:49:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-multiple-sas7bdat-files-from-folder-and-select-only/m-p/513754#M138464</guid>
      <dc:creator>VDD</dc:creator>
      <dc:date>2018-11-16T01:49:16Z</dc:date>
    </item>
    <item>
      <title>Re: Reading multiple .sas7bdat files from folder and select only required datasets whenever we need</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-multiple-sas7bdat-files-from-folder-and-select-only/m-p/513755#M138465</link>
      <description>&lt;P&gt;here is another way but you get all SAS datasets so beware&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;libname myin "&lt;SPAN&gt;SAS/sas1/sas_sub1/all_datasets&lt;/SPAN&gt;";
proc sql ;		
	select 		
		trim(libname) || '.' || memname into :dataset_vars separated by ' '
	from dictionary.tables
	where upcase(libname)="MYIN"
	and upcase(memname) like '%' 
	;
	
quit;

data myin.want;
	set &amp;amp;dataset_vars;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 16 Nov 2018 01:57:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-multiple-sas7bdat-files-from-folder-and-select-only/m-p/513755#M138465</guid>
      <dc:creator>VDD</dc:creator>
      <dc:date>2018-11-16T01:57:41Z</dc:date>
    </item>
    <item>
      <title>Re: Reading multiple .sas7bdat files from folder and select only required datasets whenever we need</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-multiple-sas7bdat-files-from-folder-and-select-only/m-p/513761#M138481</link>
      <description>&lt;P&gt;Like this?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;libname Z '/SAS/sas1/sas_sub1/all_datasets';
data WANT;
  set Z.AA Z.BB Z.CC %sysfunc(ifc(exist(Z.DD),Z.DD,));
run; &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Nov 2018 02:15:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-multiple-sas7bdat-files-from-folder-and-select-only/m-p/513761#M138481</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2018-11-16T02:15:00Z</dc:date>
    </item>
    <item>
      <title>Re: Reading multiple .sas7bdat files from folder and select only required datasets whenever we need</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-multiple-sas7bdat-files-from-folder-and-select-only/m-p/513763#M138482</link>
      <description>&lt;P&gt;Defining a SAS libref that points to the&lt;SPAN&gt;&amp;nbsp;"SAS/sas1/sas_sub1/all_datasets" path could be an option. You can then simply refer to the datasets by their names using&amp;nbsp;a libname. More info on the libname statement &lt;A href="http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000214133.htm" target="_self"&gt;here&lt;/A&gt;.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Something like this:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;* Define the libname (Note that this statement does not contain an equal sign);
libname my_libname "SAS/sas1/sas_sub1/all_datasets";

* Create a new dataset called 'all_sets' that stacks the 'AA', 'BB', and 'CC' SAS datasets;
data all_sets;
   set my_libname.AA my_libname.BB my_libname.CC;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Nov 2018 02:21:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-multiple-sas7bdat-files-from-folder-and-select-only/m-p/513763#M138482</guid>
      <dc:creator>Anthony45</dc:creator>
      <dc:date>2018-11-16T02:21:33Z</dc:date>
    </item>
  </channel>
</rss>

