<?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: dm log file does not print the log in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/dm-log-file-does-not-print-the-log/m-p/869756#M343558</link>
    <description>&lt;P&gt;Well, I don't know why you can't use PROC PRINTTO, you seem to have decided that the exact tool in SAS that allows you to save the log in a file is not an acceptable solution. Of course, you are free to make such a decision, but could you at least explain why you can't use PROC PRINTTO?&lt;/P&gt;</description>
    <pubDate>Fri, 14 Apr 2023 11:47:06 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2023-04-14T11:47:06Z</dc:date>
    <item>
      <title>dm log file does not print the log</title>
      <link>https://communities.sas.com/t5/SAS-Programming/dm-log-file-does-not-print-the-log/m-p/869745#M343552</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to print the log to file.&lt;BR /&gt;In log I should have everything above the command (proc printto log is not a solution).&lt;/P&gt;&lt;P&gt;I read I can print log to file by using DM statement.&lt;/P&gt;&lt;P&gt;Why below code does not work?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%let path = ...;&lt;BR /&gt;%let fin=&amp;amp;path.\test.log;&lt;/P&gt;&lt;P&gt;data test;&lt;BR /&gt;a="test";&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;dm log "file '&amp;amp;fin.' replace";&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;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 14 Apr 2023 11:13:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/dm-log-file-does-not-print-the-log/m-p/869745#M343552</guid>
      <dc:creator>starosto</dc:creator>
      <dc:date>2023-04-14T11:13:53Z</dc:date>
    </item>
    <item>
      <title>Re: dm log file does not print the log</title>
      <link>https://communities.sas.com/t5/SAS-Programming/dm-log-file-does-not-print-the-log/m-p/869746#M343553</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc printto log="whateverfilename.log"; run;
data test;
a="test";
run;
proc printto; run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 14 Apr 2023 11:14:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/dm-log-file-does-not-print-the-log/m-p/869746#M343553</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-04-14T11:14:53Z</dc:date>
    </item>
    <item>
      <title>Re: dm log file does not print the log</title>
      <link>https://communities.sas.com/t5/SAS-Programming/dm-log-file-does-not-print-the-log/m-p/869754#M343556</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;&amp;nbsp;thank you for your reply.&lt;BR /&gt;However, as I mentioned previously printto procedure is not a solution for me.&lt;BR /&gt;The code I am writing will be included in other codes and I do not have any guarantee that author include proc printto at the vey beginning of sas program.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;I am looking for a solution with dm statement.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 14 Apr 2023 11:43:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/dm-log-file-does-not-print-the-log/m-p/869754#M343556</guid>
      <dc:creator>starosto</dc:creator>
      <dc:date>2023-04-14T11:43:33Z</dc:date>
    </item>
    <item>
      <title>Re: dm log file does not print the log</title>
      <link>https://communities.sas.com/t5/SAS-Programming/dm-log-file-does-not-print-the-log/m-p/869756#M343558</link>
      <description>&lt;P&gt;Well, I don't know why you can't use PROC PRINTTO, you seem to have decided that the exact tool in SAS that allows you to save the log in a file is not an acceptable solution. Of course, you are free to make such a decision, but could you at least explain why you can't use PROC PRINTTO?&lt;/P&gt;</description>
      <pubDate>Fri, 14 Apr 2023 11:47:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/dm-log-file-does-not-print-the-log/m-p/869756#M343558</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-04-14T11:47:06Z</dc:date>
    </item>
    <item>
      <title>Re: dm log file does not print the log</title>
      <link>https://communities.sas.com/t5/SAS-Programming/dm-log-file-does-not-print-the-log/m-p/869773#M343565</link>
      <description>&lt;P&gt;I have no problem.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let path = c:\temp ;
%let fin=&amp;amp;path.\test.log;

data test;
a="test";
run;

dm log "file '&amp;amp;fin.' replace";&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Ksharp_0-1681474726597.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/82686iAE076CE31F28B010/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Ksharp_0-1681474726597.png" alt="Ksharp_0-1681474726597.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 14 Apr 2023 12:19:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/dm-log-file-does-not-print-the-log/m-p/869773#M343565</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2023-04-14T12:19:17Z</dc:date>
    </item>
    <item>
      <title>Re: dm log file does not print the log</title>
      <link>https://communities.sas.com/t5/SAS-Programming/dm-log-file-does-not-print-the-log/m-p/869774#M343566</link>
      <description>&lt;P&gt;You're running this code on Windows SAS in Display Manager, right?&amp;nbsp; (So not Enterprise Guide or Studio, and not a batch job)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Your code worked for me as is.&amp;nbsp; I think it's better to wrap the entire DM string in quotes, and have semicolons to end the log command and the file command.&amp;nbsp; So I tend to code this like:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;dm "log; file ""&amp;amp;fin"" replace;" ;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The single quotes you're using around &amp;amp;fin work fine, I'm just in the habit of avoiding single quotes in the macro language unless I'm using them to prevent resolution.&lt;/P&gt;</description>
      <pubDate>Fri, 14 Apr 2023 12:24:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/dm-log-file-does-not-print-the-log/m-p/869774#M343566</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2023-04-14T12:24:48Z</dc:date>
    </item>
    <item>
      <title>Re: dm log file does not print the log</title>
      <link>https://communities.sas.com/t5/SAS-Programming/dm-log-file-does-not-print-the-log/m-p/869781#M343567</link>
      <description>I am running this code in Windows SAS EG and it does not work...</description>
      <pubDate>Fri, 14 Apr 2023 13:04:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/dm-log-file-does-not-print-the-log/m-p/869781#M343567</guid>
      <dc:creator>starosto</dc:creator>
      <dc:date>2023-04-14T13:04:54Z</dc:date>
    </item>
    <item>
      <title>Re: dm log file does not print the log</title>
      <link>https://communities.sas.com/t5/SAS-Programming/dm-log-file-does-not-print-the-log/m-p/869782#M343568</link>
      <description>I am running this code in Windows SAS EG and it does not work...&lt;BR /&gt;I tried with your adjustments, and it does not work...</description>
      <pubDate>Fri, 14 Apr 2023 13:06:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/dm-log-file-does-not-print-the-log/m-p/869782#M343568</guid>
      <dc:creator>starosto</dc:creator>
      <dc:date>2023-04-14T13:06:04Z</dc:date>
    </item>
    <item>
      <title>Re: dm log file does not print the log</title>
      <link>https://communities.sas.com/t5/SAS-Programming/dm-log-file-does-not-print-the-log/m-p/869784#M343569</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/441828"&gt;@starosto&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;I am running this code in Windows SAS EG and it does not work...&lt;BR /&gt;I tried with your adjustments, and it does not work...&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;The DM statement will never work in SAS code run from Enterprise Guide because the SAS session that Enterprise Guide connects to so that it can submit and run SAS code is not running Display Manager.&amp;nbsp; So you cannot use Display Manager commands.&lt;/P&gt;</description>
      <pubDate>Fri, 14 Apr 2023 13:18:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/dm-log-file-does-not-print-the-log/m-p/869784#M343569</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2023-04-14T13:18:02Z</dc:date>
    </item>
    <item>
      <title>Re: dm log file does not print the log</title>
      <link>https://communities.sas.com/t5/SAS-Programming/dm-log-file-does-not-print-the-log/m-p/869785#M343570</link>
      <description>&lt;P&gt;The DM command will not work in EG.&amp;nbsp; It's a Display Manager command.&amp;nbsp; I don't know if EG has a way to use SAS code to save the log to a file.&amp;nbsp; You might want to ask that question in EG community.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;One workaround might be to use PROC PRINTTO as Paige mentioned.&amp;nbsp; EG does let you add custom pre-code and post-code to every submission.&amp;nbsp; So as a hack, you could add as pre-code:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc printto log='...' new;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;And as postcode:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc printto log=log;
run;
data _null_;
  input '...' ;
  put _infile_;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I really wish SAS would make it possible to execute system option ALTLOG&amp;nbsp; during a SAS session.&amp;nbsp; I think that would make it easier to capture the log as a file, without having to redirect the log.&lt;/P&gt;</description>
      <pubDate>Fri, 14 Apr 2023 13:20:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/dm-log-file-does-not-print-the-log/m-p/869785#M343570</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2023-04-14T13:20:28Z</dc:date>
    </item>
    <item>
      <title>Re: dm log file does not print the log</title>
      <link>https://communities.sas.com/t5/SAS-Programming/dm-log-file-does-not-print-the-log/m-p/869924#M343622</link>
      <description>&lt;P&gt;With SAS EG, the SAS session you are working with is more like batch SAS, so you have to use code that is compatible with batch mode. PROC PRINTO will work but DM statements wont.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If I want log files, I find it easier just to run the complete program as a batch job which produces a log file automatically, no coding required. That way your EG and batch job code can be exactly the same. Running in EG, the log goes to the log panel, in batch it is written to the log file. Batch jobs in SAS 9.4 can be run from the SAS Management Console tool as it isn't available in EG.&lt;/P&gt;</description>
      <pubDate>Fri, 14 Apr 2023 23:01:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/dm-log-file-does-not-print-the-log/m-p/869924#M343622</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2023-04-14T23:01:16Z</dc:date>
    </item>
  </channel>
</rss>

