<?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: creating a global dataset then appending the other dataset to it in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/creating-a-global-dataset-then-appending-the-other-dataset-to-it/m-p/764940#M39444</link>
    <description>Your code is nesting data step statements inside loops incorrectly. If you want to conditionally execute code you need to use macro code or to use CALL EXECUTE or DOSUBL so how you're building your program is incorrect. You have the correct concepts but not the correct syntax. FYI - this is very similar to issues in your previous questions and the answer/solution is the same idea. &lt;BR /&gt;&lt;BR /&gt;Also, is there a point to automating this? This seems like something you'd do once so what's the point of generating nice code to automate this? Wouldn't the code below generate the exact same results?&lt;BR /&gt;&lt;BR /&gt;data global;&lt;BR /&gt;set d202106: ;&lt;BR /&gt;run;</description>
    <pubDate>Mon, 30 Aug 2021 19:55:37 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2021-08-30T19:55:37Z</dc:date>
    <item>
      <title>creating a global dataset then appending the other dataset to it</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/creating-a-global-dataset-then-appending-the-other-dataset-to-it/m-p/764936#M39443</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;imagine that in my /folder1/subfolder1 , I have dataset named as below&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;test_d20210601&lt;/P&gt;
&lt;P&gt;test_d20210602&lt;/P&gt;
&lt;P&gt;...&lt;/P&gt;
&lt;P&gt;test_d20210630&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What I would like to do is to take the first dataset (test_d20210601) and rename it global.&amp;nbsp; Thereafter to append all the other datasets into the global.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's my code:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;libname src2 spde '/folder1/subfolder1';&lt;BR /&gt;data _null_; &lt;BR /&gt;length fname $ 20;&lt;BR /&gt;format date yymmddn8.;&lt;/P&gt;
&lt;P&gt;do date='01JUN2021'd to '30JUN2021'd;&lt;BR /&gt;IF put(date,yymmddn8.) eq 20210601 then&lt;BR /&gt;do;&lt;BR /&gt;fname=strip(cats('test_d',put(date,yymmddn8.)));&lt;BR /&gt;put fname;&lt;BR /&gt;/*&lt;BR /&gt;Data global;&lt;BR /&gt;set src2.fname;&lt;BR /&gt;run;&lt;BR /&gt;*/&lt;/P&gt;
&lt;P&gt;end;&lt;BR /&gt;else&lt;BR /&gt;do;&lt;BR /&gt;fname=strip(cats('test_dd',put(date,yymmddn8.)));&lt;BR /&gt;put fname;&lt;BR /&gt;/*&lt;BR /&gt;fname=strip(cats('test_d',put(date,yymmddn8.)));&lt;BR /&gt;proc append base=global data=src2.fname;&lt;BR /&gt;run;&lt;BR /&gt;*/&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;end;&lt;BR /&gt;END;&lt;BR /&gt;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This code works perferctly if I want to get the fname into the log file.&lt;/P&gt;
&lt;P&gt;However, if I want to comment the put fname and comment out the piece of code that was comment in, it is not working.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What's wrong in my code.&lt;/P&gt;
&lt;P&gt;Is it possible to create a dataset then append the other the way I would like to do it?&lt;/P&gt;
&lt;P&gt;if not what's the best way?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 30 Aug 2021 19:47:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/creating-a-global-dataset-then-appending-the-other-dataset-to-it/m-p/764936#M39443</guid>
      <dc:creator>alepage</dc:creator>
      <dc:date>2021-08-30T19:47:09Z</dc:date>
    </item>
    <item>
      <title>Re: creating a global dataset then appending the other dataset to it</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/creating-a-global-dataset-then-appending-the-other-dataset-to-it/m-p/764940#M39444</link>
      <description>Your code is nesting data step statements inside loops incorrectly. If you want to conditionally execute code you need to use macro code or to use CALL EXECUTE or DOSUBL so how you're building your program is incorrect. You have the correct concepts but not the correct syntax. FYI - this is very similar to issues in your previous questions and the answer/solution is the same idea. &lt;BR /&gt;&lt;BR /&gt;Also, is there a point to automating this? This seems like something you'd do once so what's the point of generating nice code to automate this? Wouldn't the code below generate the exact same results?&lt;BR /&gt;&lt;BR /&gt;data global;&lt;BR /&gt;set d202106: ;&lt;BR /&gt;run;</description>
      <pubDate>Mon, 30 Aug 2021 19:55:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/creating-a-global-dataset-then-appending-the-other-dataset-to-it/m-p/764940#M39444</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-08-30T19:55:37Z</dc:date>
    </item>
    <item>
      <title>Re: creating a global dataset then appending the other dataset to it</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/creating-a-global-dataset-then-appending-the-other-dataset-to-it/m-p/764950#M39445</link>
      <description>&lt;P&gt;Yes you are right.&lt;/P&gt;</description>
      <pubDate>Mon, 30 Aug 2021 20:44:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/creating-a-global-dataset-then-appending-the-other-dataset-to-it/m-p/764950#M39445</guid>
      <dc:creator>alepage</dc:creator>
      <dc:date>2021-08-30T20:44:18Z</dc:date>
    </item>
  </channel>
</rss>

