<?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 executed code to external file in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Export-executed-code-to-external-file/m-p/374518#M89696</link>
    <description>&lt;P&gt;And what is the question? &amp;nbsp;You have code posted above, some of which you have marked as the answer to your question. &amp;nbsp;If this does not fill your needs then open a new topic, post test data in the form of a datastep, post example output, and what you have tried.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 10 Jul 2017 14:21:26 GMT</pubDate>
    <dc:creator>RW9</dc:creator>
    <dc:date>2017-07-10T14:21:26Z</dc:date>
    <item>
      <title>Export executed code to external file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Export-executed-code-to-external-file/m-p/367255#M87408</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;We have a SAS code executed regulary in our data management department. Programs are pretty large (20000 lines) with lots of parametres. Every time we save logs to external files and I wonder if it is possible also to save interpreted code (all variables evaluated) or the base code once executed to external text file&amp;nbsp;too?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks in advance for your ansvers.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Jun 2017 07:46:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Export-executed-code-to-external-file/m-p/367255#M87408</guid>
      <dc:creator>gabriel_k</dc:creator>
      <dc:date>2017-06-15T07:46:41Z</dc:date>
    </item>
    <item>
      <title>Re: Export executed code to external file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Export-executed-code-to-external-file/m-p/367261#M87412</link>
      <description>&lt;P&gt;Please explain what you mean by interpreted code. Do you mean the code generated by SAS macros or something else? If you are referring to the generated SAS macro code then using the SAS options MPRINT will add this to the SAS log and if you want the resolved SAS macro variable values use SYMBOLGEN.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The SAS "base" code is simply what is stored in your SAS programs, unless you are generating your code by some other means. If this is the case please explain.&lt;/P&gt;</description>
      <pubDate>Thu, 15 Jun 2017 08:03:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Export-executed-code-to-external-file/m-p/367261#M87412</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2017-06-15T08:03:48Z</dc:date>
    </item>
    <item>
      <title>Re: Export executed code to external file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Export-executed-code-to-external-file/m-p/367263#M87413</link>
      <description>&lt;P&gt;In what sense? &amp;nbsp;You have a program that exports data, therefore that program is stored somewhere as a file, hence you already have this? &amp;nbsp;Or are you using some macro or something to generate code, or are you using proc export or something. &amp;nbsp;Some examples might help. &amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Jun 2017 08:05:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Export-executed-code-to-external-file/m-p/367263#M87413</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-06-15T08:05:30Z</dc:date>
    </item>
    <item>
      <title>Re: Export executed code to external file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Export-executed-code-to-external-file/m-p/367315#M87428</link>
      <description>&lt;P&gt;You can save the generated code to a file of your choice using the MFILE&amp;nbsp;option. &amp;nbsp;(I believe you need to turn on MPRINT as well to make MFILE effective.)&lt;/P&gt;</description>
      <pubDate>Thu, 15 Jun 2017 11:09:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Export-executed-code-to-external-file/m-p/367315#M87428</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2017-06-15T11:09:21Z</dc:date>
    </item>
    <item>
      <title>Re: Export executed code to external file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Export-executed-code-to-external-file/m-p/367319#M87430</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;the MFILE MPRINT functionality is explained &lt;A href="http://support.sas.com/resources/papers/proceedings14/1302-2014.pdf" target="_blank"&gt;&amp;gt;here&amp;lt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Edit: maybe turning on these options is sufficient for you:&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;options&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New"&gt;mprint&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New"&gt;mprintnest&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New"&gt;source&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New"&gt;source2&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;PRE&gt;&lt;FONT face="Courier New"&gt;&lt;CODE class=" language-sas"&gt;options nomprint nomprintnest nosource nosource2;

%macro test(initial);
proc print data=sashelp.class;where substr(name,1,1) eq "&amp;amp;initial.";run;

%mend test;

%test(A);
%test(J);

options mprint mprintnest source source2;

%macro test(initial);
proc print data=sashelp.class;where substr(name,1,1) eq "&amp;amp;initial.";run;

%mend test;

%test(A);
%test(J);&lt;/CODE&gt;&lt;/FONT&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 15 Jun 2017 11:53:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Export-executed-code-to-external-file/m-p/367319#M87430</guid>
      <dc:creator>Oligolas</dc:creator>
      <dc:date>2017-06-15T11:53:06Z</dc:date>
    </item>
    <item>
      <title>Re: Export executed code to external file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Export-executed-code-to-external-file/m-p/367321#M87431</link>
      <description>&lt;P&gt;I mean the code &lt;SPAN&gt; generated by SAS macros you are wright, and it would be great to have it appart of the log that it is possible to execute this code directly in case I need.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Jun 2017 11:44:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Export-executed-code-to-external-file/m-p/367321#M87431</guid>
      <dc:creator>gabriel_k</dc:creator>
      <dc:date>2017-06-15T11:44:57Z</dc:date>
    </item>
    <item>
      <title>Re: Export executed code to external file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Export-executed-code-to-external-file/m-p/367324#M87433</link>
      <description>There is some macro code, sas base code, it exports and imorts data.. does lots of stuff, the question is how to keep track of final code executed and try to have it in the file to rerun the later in case of problems or something.</description>
      <pubDate>Thu, 15 Jun 2017 11:50:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Export-executed-code-to-external-file/m-p/367324#M87433</guid>
      <dc:creator>gabriel_k</dc:creator>
      <dc:date>2017-06-15T11:50:10Z</dc:date>
    </item>
    <item>
      <title>Re: Export executed code to external file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Export-executed-code-to-external-file/m-p/367327#M87434</link>
      <description>&lt;P&gt;As&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/77163"&gt;@Oligolas&lt;/a&gt;&amp;nbsp;provided (note I would add symbolgen in also):&lt;/P&gt;
&lt;P&gt;options mlogic mprint symbolgen source source2;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Before the run should put all the required information in the log. &amp;nbsp;However the log itself will not be "executable" like your requirement. &amp;nbsp;I think that would require quite some re-work, having the code you already have, instead of running, creating a text file output which is included at the end of the program. &amp;nbsp;But the question is, why can you not re-run the code you have as apposed to the log? &amp;nbsp;If your code isn't replicable then there is something fundamentally wrong with thr process. &amp;nbsp;The code should run the same with the same inputs and create the same output each time.&lt;/P&gt;</description>
      <pubDate>Thu, 15 Jun 2017 11:59:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Export-executed-code-to-external-file/m-p/367327#M87434</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-06-15T11:59:38Z</dc:date>
    </item>
    <item>
      <title>Re: Export executed code to external file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Export-executed-code-to-external-file/m-p/368207#M87786</link>
      <description>&lt;PRE&gt;filename mprint "...\mysasfile1.sas";
options mprint mfile;
run; 
options mprint mprintnest source source2;
%macro test(initial);
proc print data=sashelp.class;
where substr(name,1,1) eq "&amp;amp;initial.";
run;
%mend test;
%test(A);
%test(J);&lt;/PRE&gt;
&lt;P&gt;Trying to run your code with the parts mentioned in the article, everything goes smooth no errors ... but code is not printed to the file. What could it be?&lt;/P&gt;</description>
      <pubDate>Mon, 19 Jun 2017 09:25:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Export-executed-code-to-external-file/m-p/368207#M87786</guid>
      <dc:creator>gabriel_k</dc:creator>
      <dc:date>2017-06-19T09:25:16Z</dc:date>
    </item>
    <item>
      <title>Re: Export executed code to external file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Export-executed-code-to-external-file/m-p/368217#M87788</link>
      <description>&lt;P&gt;Works fine for me:&lt;/P&gt;
&lt;PRE&gt;filename mprint "...\mysasfile1.sas";
options mprint mfile mprintnest source source2;
%macro test(initial);
  proc print data=sashelp.class;
    where substr(name,1,1) eq "&amp;amp;initial.";
  run;
%mend test;
%test(A);
%test(J);&lt;/PRE&gt;
&lt;P&gt;Make sure your path in the mprint statement exists, you have access to it, and it can overwrite any file there. &amp;nbsp;You should get a log message if it doesnt work.&lt;/P&gt;</description>
      <pubDate>Mon, 19 Jun 2017 09:51:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Export-executed-code-to-external-file/m-p/368217#M87788</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-06-19T09:51:13Z</dc:date>
    </item>
    <item>
      <title>Re: Export executed code to external file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Export-executed-code-to-external-file/m-p/368257#M87803</link>
      <description>&lt;P&gt;Probably there was some problem with server I've tried it later and it works fine, that is exectly what I was looking for. thanks a lot:)&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Jun 2017 12:05:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Export-executed-code-to-external-file/m-p/368257#M87803</guid>
      <dc:creator>gabriel_k</dc:creator>
      <dc:date>2017-06-19T12:05:52Z</dc:date>
    </item>
    <item>
      <title>Re: Export executed code to external file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Export-executed-code-to-external-file/m-p/369166#M88094</link>
      <description>&lt;P&gt;Is it possible to make SAS interpret the variables also?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For instance if I have a DATA step the&amp;nbsp;macro variables inside are not interpreted in generated code.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Jun 2017 14:28:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Export-executed-code-to-external-file/m-p/369166#M88094</guid>
      <dc:creator>gabriel_k</dc:creator>
      <dc:date>2017-06-21T14:28:41Z</dc:date>
    </item>
    <item>
      <title>Re: Export executed code to external file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Export-executed-code-to-external-file/m-p/369188#M88102</link>
      <description>&lt;P&gt;Not sure I follow you. &amp;nbsp;Could you provide a small example to illustrate your problem.&lt;/P&gt;</description>
      <pubDate>Wed, 21 Jun 2017 15:13:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Export-executed-code-to-external-file/m-p/369188#M88102</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-06-21T15:13:00Z</dc:date>
    </item>
    <item>
      <title>Re: Export executed code to external file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Export-executed-code-to-external-file/m-p/369195#M88108</link>
      <description>&lt;P&gt;Never mind, its fine, I'll run first the code that defins variables.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Jun 2017 15:24:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Export-executed-code-to-external-file/m-p/369195#M88108</guid>
      <dc:creator>gabriel_k</dc:creator>
      <dc:date>2017-06-21T15:24:22Z</dc:date>
    </item>
    <item>
      <title>Re: Export executed code to external file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Export-executed-code-to-external-file/m-p/374504#M89688</link>
      <description>&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have found this article and would like to do exectly they are doing.&lt;/P&gt;
&lt;P&gt;&lt;A href="http://www.lexjansen.com/pharmasug/2002/proceed/TechTech/tt14.pdf" target="_blank"&gt;http://www.lexjansen.com/pharmasug/2002/proceed/TechTech/tt14.pdf&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;I have contacted autors but don't have an answer so far. May be you have seen an example of a similar program on the internet? &amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jul 2017 14:06:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Export-executed-code-to-external-file/m-p/374504#M89688</guid>
      <dc:creator>gabriel_k</dc:creator>
      <dc:date>2017-07-10T14:06:35Z</dc:date>
    </item>
    <item>
      <title>Re: Export executed code to external file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Export-executed-code-to-external-file/m-p/374518#M89696</link>
      <description>&lt;P&gt;And what is the question? &amp;nbsp;You have code posted above, some of which you have marked as the answer to your question. &amp;nbsp;If this does not fill your needs then open a new topic, post test data in the form of a datastep, post example output, and what you have tried.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jul 2017 14:21:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Export-executed-code-to-external-file/m-p/374518#M89696</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-07-10T14:21:26Z</dc:date>
    </item>
  </channel>
</rss>

