<?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: How to apply multiple do loops to scan through multiple libraries and datasets efficiently in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/How-to-apply-multiple-do-loops-to-scan-through-multiple/m-p/509597#M1803</link>
    <description>&lt;P&gt;Thanks for getting me on the right track.&amp;nbsp; I ended up putting&amp;nbsp;&lt;/P&gt;&lt;P&gt;%if %sysfunc(exist(dataset)) %then %do;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%end;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;around my code and it gave me a log if the dataset existed in that loop.&lt;/P&gt;</description>
    <pubDate>Thu, 01 Nov 2018 16:38:26 GMT</pubDate>
    <dc:creator>bdemir</dc:creator>
    <dc:date>2018-11-01T16:38:26Z</dc:date>
    <item>
      <title>How to apply multiple do loops to scan through multiple libraries and datasets efficiently</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-apply-multiple-do-loops-to-scan-through-multiple/m-p/505400#M1159</link>
      <description>&lt;P&gt;I am trying to do a couple do loops (or if there is anything more efficient I would like to hear) where I need to first go to the regional library.&amp;nbsp; Each library can have multiple states.&amp;nbsp; The code below works but when it goes through the regional folders, it goes through all 52 states and gives an error for the states that do not exist in that folder.&amp;nbsp; Is there a more efficient/ cleaner log way where if the state is not in the regional folder,&amp;nbsp;SAS skips it without an error message?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%syslput STATE1 = AK;
.
.
.
%syslput STATE52 = WY;

%let STATE1 = AK;
.
.
.
%let STATE52 = WY;

%syslput REGION1 = R1;
.
.
.
%syslput REGION8 = R9;

%macro onest;
%do r = 1 %to 8;
	%syslput r = &amp;amp;R;
 %do s = 1 %to 52;
 	%syslput s = &amp;amp;S;
		rsubmit;
		proc sql;
		Connect to oracle
			(path = xxxx user = &amp;amp;user pw = &amp;amp;pw);
		create table &amp;amp;USER..&amp;amp;&amp;amp;STATE&amp;amp;S.._RX_HEADER as
		 select * 
			from connection to oracle
			(
			  select distinct a.*
		  		from M_&amp;amp;&amp;amp;REGION&amp;amp;R.._OWN.&amp;amp;&amp;amp;STATE&amp;amp;S.._RX a 
		   
			);
		disconnect from oracle;
		quit;
		endrsubmit;

		%end;
	   %end;

%mend onest;
%onest&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 17 Oct 2018 23:50:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-apply-multiple-do-loops-to-scan-through-multiple/m-p/505400#M1159</guid>
      <dc:creator>bdemir</dc:creator>
      <dc:date>2018-10-17T23:50:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to apply multiple do loops to scan through multiple libraries and datasets efficiently</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-apply-multiple-do-loops-to-scan-through-multiple/m-p/505417#M1163</link>
      <description>Do you have to use Pass through SQL or is a libname or a PROC SQL an option? If they are you may have more options on how to solve something like this. For example you could check for the existence of a table first.</description>
      <pubDate>Thu, 18 Oct 2018 02:57:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-apply-multiple-do-loops-to-scan-through-multiple/m-p/505417#M1163</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-10-18T02:57:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to apply multiple do loops to scan through multiple libraries and datasets efficiently</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-apply-multiple-do-loops-to-scan-through-multiple/m-p/509597#M1803</link>
      <description>&lt;P&gt;Thanks for getting me on the right track.&amp;nbsp; I ended up putting&amp;nbsp;&lt;/P&gt;&lt;P&gt;%if %sysfunc(exist(dataset)) %then %do;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%end;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;around my code and it gave me a log if the dataset existed in that loop.&lt;/P&gt;</description>
      <pubDate>Thu, 01 Nov 2018 16:38:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-apply-multiple-do-loops-to-scan-through-multiple/m-p/509597#M1803</guid>
      <dc:creator>bdemir</dc:creator>
      <dc:date>2018-11-01T16:38:26Z</dc:date>
    </item>
  </channel>
</rss>

