<?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: Nested do loop in marco generating empty datasets in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Nested-do-loop-in-marco-generating-empty-datasets/m-p/755519#M238433</link>
    <description>&lt;P&gt;I reran your code without any duplicates and I didn't find any duplicate datasets as you have mentioned. see it below. ( I executed it on SAS On Demand for Academics)&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Sajid01_0-1626828783330.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/61474iE3F5767B96326029/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Sajid01_0-1626828783330.png" alt="Sajid01_0-1626828783330.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;I have attached the log.&lt;/P&gt;
&lt;P&gt;Needless to say that filesystems do not allow files of exactly the same name.&lt;/P&gt;</description>
    <pubDate>Wed, 21 Jul 2021 01:07:44 GMT</pubDate>
    <dc:creator>Sajid01</dc:creator>
    <dc:date>2021-07-21T01:07:44Z</dc:date>
    <item>
      <title>Nested do loop in marco generating empty datasets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Nested-do-loop-in-marco-generating-empty-datasets/m-p/754501#M237943</link>
      <description>&lt;P&gt;Background: I am conducting a sensitivity analysis where I am looping over combinations of two parameters A and B, where A=1,2 and B=1 to 9. I have saved down datasets for each of the 18 combinations of the two parameter values and I now would like to write a macro the generate summary statistics, by group, for 6 output variables I am interested in.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Problem: If I limit B to B=1 to 8 I get the 16 desired output datasets, however if I loop over B=1 to 9 I inexplicably get 21 output datasets, where the the output for the output for some iterations is duplicated, and trying to open the duplicates produces an error: "Cannot open dataset, file does not exist".&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ChristianWI_0-1626416105213.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/61292iE7710FDDF7FC54B0/image-size/medium?v=v2&amp;amp;px=400" role="button" title="ChristianWI_0-1626416105213.png" alt="ChristianWI_0-1626416105213.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Although I do ultimately get the desired output, there must be something going wrong to produce the additional duplicate datasets.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Example code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;data data;
input group $ var1-var6;
datalines;
group1 1 2 3 4 5 6
group2 7 8 9 10 11 12
;
run;

%macro example;
%do i = 1 %to 2;
	%do j = 1 %to 9;
		%let case = A&amp;amp;i._B&amp;amp;j.;
		data case_A&amp;amp;i._B&amp;amp;j.;
		set data;
		case = "&amp;amp;case.";
		run;
	%end;
%end;
%mend;
%example&lt;/PRE&gt;&lt;P&gt;Any help would be greatly appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Jul 2021 06:26:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Nested-do-loop-in-marco-generating-empty-datasets/m-p/754501#M237943</guid>
      <dc:creator>ChristianWI</dc:creator>
      <dc:date>2021-07-16T06:26:42Z</dc:date>
    </item>
    <item>
      <title>Re: Nested do loop in marco generating empty datasets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Nested-do-loop-in-marco-generating-empty-datasets/m-p/755495#M238416</link>
      <description>&lt;P&gt;I doubt you create additional tables, check your log to verify. If not, then it looks like a display problem by the SAS client. In this case, you should contact SAS tech support.&lt;/P&gt;</description>
      <pubDate>Tue, 20 Jul 2021 22:45:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Nested-do-loop-in-marco-generating-empty-datasets/m-p/755495#M238416</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2021-07-20T22:45:49Z</dc:date>
    </item>
    <item>
      <title>Re: Nested do loop in marco generating empty datasets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Nested-do-loop-in-marco-generating-empty-datasets/m-p/755519#M238433</link>
      <description>&lt;P&gt;I reran your code without any duplicates and I didn't find any duplicate datasets as you have mentioned. see it below. ( I executed it on SAS On Demand for Academics)&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Sajid01_0-1626828783330.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/61474iE3F5767B96326029/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Sajid01_0-1626828783330.png" alt="Sajid01_0-1626828783330.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;I have attached the log.&lt;/P&gt;
&lt;P&gt;Needless to say that filesystems do not allow files of exactly the same name.&lt;/P&gt;</description>
      <pubDate>Wed, 21 Jul 2021 01:07:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Nested-do-loop-in-marco-generating-empty-datasets/m-p/755519#M238433</guid>
      <dc:creator>Sajid01</dc:creator>
      <dc:date>2021-07-21T01:07:44Z</dc:date>
    </item>
    <item>
      <title>Re: Nested do loop in marco generating empty datasets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Nested-do-loop-in-marco-generating-empty-datasets/m-p/755530#M238443</link>
      <description>&lt;P&gt;&lt;EM&gt;&amp;gt;&amp;nbsp;Needless to say that filesystems do not allow files of exactly the same name.&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;I wonder what SAS sees if you have identical names but different cases under Linux/Unix. Like:&lt;/P&gt;
&lt;P&gt;test.sas7bdat&lt;/P&gt;
&lt;P&gt;Test.sas7bdat&lt;/P&gt;
&lt;P&gt;SAS names are supposed to be lower case, so does SAS ignore the other files?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Jul 2021 01:43:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Nested-do-loop-in-marco-generating-empty-datasets/m-p/755530#M238443</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2021-07-21T01:43:46Z</dc:date>
    </item>
    <item>
      <title>Re: Nested do loop in marco generating empty datasets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Nested-do-loop-in-marco-generating-empty-datasets/m-p/755540#M238453</link>
      <description>Unix/Linux are case sensitive.&lt;BR /&gt;For example test and Test are not the same.&lt;BR /&gt;</description>
      <pubDate>Wed, 21 Jul 2021 02:20:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Nested-do-loop-in-marco-generating-empty-datasets/m-p/755540#M238453</guid>
      <dc:creator>Sajid01</dc:creator>
      <dc:date>2021-07-21T02:20:58Z</dc:date>
    </item>
    <item>
      <title>Re: Nested do loop in marco generating empty datasets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Nested-do-loop-in-marco-generating-empty-datasets/m-p/755544#M238456</link>
      <description>&lt;P&gt;&lt;EM&gt;&amp;gt; For example test and Test are not the same.&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Exactly. Hence my question.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Jul 2021 02:32:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Nested-do-loop-in-marco-generating-empty-datasets/m-p/755544#M238456</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2021-07-21T02:32:37Z</dc:date>
    </item>
    <item>
      <title>Re: Nested do loop in marco generating empty datasets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Nested-do-loop-in-marco-generating-empty-datasets/m-p/755550#M238461</link>
      <description>&lt;P&gt;Thanks for this. I did check the log and only 18 datasets were recorded as having been generated which added even more to my confusion. I forgot to mention this in my post, but it sounds like you are correct in that is is most likely a display problem.&lt;/P&gt;</description>
      <pubDate>Wed, 21 Jul 2021 02:58:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Nested-do-loop-in-marco-generating-empty-datasets/m-p/755550#M238461</guid>
      <dc:creator>ChristianWI</dc:creator>
      <dc:date>2021-07-21T02:58:02Z</dc:date>
    </item>
    <item>
      <title>Re: Nested do loop in marco generating empty datasets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Nested-do-loop-in-marco-generating-empty-datasets/m-p/755588#M238482</link>
      <description>&lt;P&gt;At least with 9.4M7 on AIX and EG 7.15, only .sas7bdat files in all lowercase will appear in the library list.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But IIRC, there was a time when SAS would list all files with extension .sas7bdat as datasets (including those that had a capital letter before the extension), but would have trouble opening those that were not all lowercase.&lt;/P&gt;</description>
      <pubDate>Wed, 21 Jul 2021 10:27:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Nested-do-loop-in-marco-generating-empty-datasets/m-p/755588#M238482</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-07-21T10:27:26Z</dc:date>
    </item>
    <item>
      <title>Re: Nested do loop in marco generating empty datasets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Nested-do-loop-in-marco-generating-empty-datasets/m-p/755607#M238486</link>
      <description>&lt;P&gt;As has been mentioned UNIX filesystems are case sensitive.&amp;nbsp; So a file named CASE_A2_B9.sas7bdat is not the same file as one named case_a2_b9.sas7bdat.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SAS on unix will only use lowercase letters in the names of files used to store SAS datasets.&amp;nbsp; So if you run this program:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data copy;
  set sasuser.CASE_A2_B9;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;It will look for a file name case_a2_b9.sas7bdat in the directory pointed to by the SASUSER libref.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Using a quoted physical name to reference the dataset in your SAS code will not help.&amp;nbsp; If you write code like:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data copy;
  set "~/sasuser/CASE_A2_B9.sas7bdat";
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Under the hood SAS will create a new libref pointing to the ~/sasuser/ directory and reference the dataset the same way as if you had use two level name to begin with.&lt;/P&gt;</description>
      <pubDate>Wed, 21 Jul 2021 12:24:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Nested-do-loop-in-marco-generating-empty-datasets/m-p/755607#M238486</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-07-21T12:24:13Z</dc:date>
    </item>
  </channel>
</rss>

