<?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: Export dataset within macro in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Export-dataset-within-macro/m-p/683357#M206964</link>
    <description>Thanks. Are there any options / settings to print a dataset to the log or output screen as the code repeats?</description>
    <pubDate>Fri, 11 Sep 2020 20:30:14 GMT</pubDate>
    <dc:creator>iepritchard</dc:creator>
    <dc:date>2020-09-11T20:30:14Z</dc:date>
    <item>
      <title>Export dataset within macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Export-dataset-within-macro/m-p/683331#M206951</link>
      <description>I have a piece of code which is set to repeat with a gap of 5 minutes after each run. As part of this code after each run I want to export a SAS dataset into an open spreadsheet (which is then overwritten 5mins later as the code repeats). I want to be able to see the updated datasets as they update without stopping the loop in SAS. Any tips on how to do this please?</description>
      <pubDate>Fri, 11 Sep 2020 18:41:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Export-dataset-within-macro/m-p/683331#M206951</guid>
      <dc:creator>iepritchard</dc:creator>
      <dc:date>2020-09-11T18:41:02Z</dc:date>
    </item>
    <item>
      <title>Re: Export dataset within macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Export-dataset-within-macro/m-p/683353#M206963</link>
      <description>&lt;P&gt;AFAIK, a spreadsheet is always write-protected if opened by another user, unless this user themselves has opened it as write-protected.&lt;/P&gt;
&lt;P&gt;It's a similar issue in SAS: if a user has a dataset open in file viewer or any other SAS method, you can't write to it.&lt;/P&gt;</description>
      <pubDate>Fri, 11 Sep 2020 20:16:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Export-dataset-within-macro/m-p/683353#M206963</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-09-11T20:16:51Z</dc:date>
    </item>
    <item>
      <title>Re: Export dataset within macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Export-dataset-within-macro/m-p/683357#M206964</link>
      <description>Thanks. Are there any options / settings to print a dataset to the log or output screen as the code repeats?</description>
      <pubDate>Fri, 11 Sep 2020 20:30:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Export-dataset-within-macro/m-p/683357#M206964</guid>
      <dc:creator>iepritchard</dc:creator>
      <dc:date>2020-09-11T20:30:14Z</dc:date>
    </item>
    <item>
      <title>Re: Export dataset within macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Export-dataset-within-macro/m-p/683358#M206965</link>
      <description>&lt;P&gt;What would be the advantage of specifically writing to a spreadsheet in this context?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Assuming your loops operate in the time interval you describe you would not have time to modify the results for any run. If you have more columns or rows written to than the open width by the time you try to read anything you are likely running out of time just scrolling up/down or left/right.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The only approach that I think has any chance would be 1) open the spreadsheet before anything else for DDE and then 2) use the DDE commands to update cells in the "export" section.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Conerns: DDE is not actively supported, only available for specific applications and operating systems (Microsoft applications like Excel / Windows), is very sensitive to the version of the application for some actions, not updated with promise the next "update" to Excel won't remove the links, and probably a few other things that don't come to mind as the last time I touched DDE was 5 years ago.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 11 Sep 2020 23:28:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Export-dataset-within-macro/m-p/683358#M206965</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-09-11T23:28:42Z</dc:date>
    </item>
    <item>
      <title>Re: Export dataset within macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Export-dataset-within-macro/m-p/683359#M206966</link>
      <description>&lt;P&gt;What are you actually trying to achieve with all this, what is your final goal (Maxim 43)?&lt;/P&gt;</description>
      <pubDate>Fri, 11 Sep 2020 20:37:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Export-dataset-within-macro/m-p/683359#M206966</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-09-11T20:37:22Z</dc:date>
    </item>
    <item>
      <title>Re: Export dataset within macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Export-dataset-within-macro/m-p/683631#M207087</link>
      <description>&lt;P&gt;I have a 'live' sales data table&amp;nbsp;which updates in real time with sales values. Every 5 minutes I want to get the sum of all sales made and then append to a secondary table which is storing all historical records. Rather than someone clicking run every 5 mins I want to automate the process - which I think I've achieved in the code below. However, I also need to be able to see how the sales figures in the 'master' data table are increasing and this is what I don't know how to do while the macro loop is still running. Ideally I would like the 'master' data in a spreadsheet so I can have a graph/chart updating as the data updates.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%macro sales ;&lt;/P&gt;&lt;P&gt;%let count=0 ;&lt;/P&gt;&lt;P&gt;%do %until (&amp;amp;count=2) ;&lt;/P&gt;&lt;P&gt;%let count=%eval(&amp;amp;count+1);&lt;/P&gt;&lt;P&gt;　&lt;/P&gt;&lt;P&gt;/* Latest snapshot */&lt;/P&gt;&lt;P&gt;data interim ;&lt;/P&gt;&lt;P&gt;set livesales;&lt;/P&gt;&lt;P&gt;format runtime time. ;&lt;/P&gt;&lt;P&gt;runtime = time() ;&lt;/P&gt;&lt;P&gt;run ;&lt;/P&gt;&lt;P&gt;　&lt;/P&gt;&lt;P&gt;/* Append to previous records */&lt;/P&gt;&lt;P&gt;data master ;&lt;/P&gt;&lt;P&gt;set master interim ;&lt;/P&gt;&lt;P&gt;run ;&lt;/P&gt;&lt;P&gt;　&lt;/P&gt;&lt;P&gt;/* Delay next run for 5 minutes */&lt;/P&gt;&lt;P&gt;data _null_ ;&lt;/P&gt;&lt;P&gt;rc=sleep(300,1) ;&lt;/P&gt;&lt;P&gt;run ;&lt;/P&gt;&lt;P&gt;　&lt;/P&gt;&lt;P&gt;%end ;&lt;/P&gt;&lt;P&gt;%mend ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%sales ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Sep 2020 12:09:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Export-dataset-within-macro/m-p/683631#M207087</guid>
      <dc:creator>iepritchard</dc:creator>
      <dc:date>2020-09-14T12:09:04Z</dc:date>
    </item>
    <item>
      <title>Re: Export dataset within macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Export-dataset-within-macro/m-p/683642#M207090</link>
      <description>&lt;P&gt;Have the SAS program create a web page (ODS HTML) within the loop that has the HTTP META tag REFRESH set to 300 (use the METATEXT option in the ODS HTML statement). Then you open the page once in your browser, and it automatically refreshes every 5 minutes.&lt;/P&gt;</description>
      <pubDate>Mon, 14 Sep 2020 12:58:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Export-dataset-within-macro/m-p/683642#M207090</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-09-14T12:58:36Z</dc:date>
    </item>
    <item>
      <title>Re: Export dataset within macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Export-dataset-within-macro/m-p/684096#M207277</link>
      <description>&lt;P&gt;I learned a lot, thanks&lt;/P&gt;</description>
      <pubDate>Wed, 16 Sep 2020 02:16:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Export-dataset-within-macro/m-p/684096#M207277</guid>
      <dc:creator>stellaa9x</dc:creator>
      <dc:date>2020-09-16T02:16:37Z</dc:date>
    </item>
  </channel>
</rss>

