Hello, we've just upgraded to SAS v9.04.01 on windows 7. The programs I run created a log file and also output the executed codes to the log window for QC. Since the upgrade, sometimes the log doesn't display the first 95 lines of executed codes. Could someone please help? Thanks.
Hi Shmuel, ballardw, and Tom,
I think I figured out what was causing the issue. After Shmuel suggested maybe the log was still held by the previous script/session/OS, I started checking for consistency uses of the last DM statement on the scripts. I found that some of the DM statement at the end of some of the scripts were modified by one of the analysts using
dm log 'print file = "K:\...\&mfolder\&measure.-Historic Data Run &memschema..log" replace' LOG;
instead of
dm 'log; file "K:\...\&mfolder\&measure.-Historic Data Run &memschema..log" replace';
Also, they didn't put the ods pdf close statement at the end of the script. So, when I submitted this one, it was okay until the subsequent scripts were submitted then the issue occurred. That's why it seemed so random.
I made the fix using the DM 'log; file ....log" replace'; and haven't seen the issue since.
Thank you all for taking the time to try helping me.
It would likely help to show 1) the code that generates the issue and 2) a log from running that code.
Hi ballardw, I've attached the script & log for your references. The strange thing this issue occur at random.
If you want to have a clean SAS log file then
If you want help with debugging why the log was cleared provide the code for at least these six macros that your program is calling. Perhaps they also have DM commands in them.
%Today; /* set up macro variable (today) that contains the current date */
%Start_Time; /* capture date time start of program initiation */
%Locking_Log(measure=APC,run=NUM); /* check for prior run in HDMPRD */
...
%PPO_STATE(memtable=Member_Elig,measure=APC,excl_rsns=NONE);
...
%med_prime(memtable=Member_Elig,measure=APC,excl_rsns=NONE);
...
%hospice(memtable=Member_Elig,measure=APC,excl_rsns=NONE);
If you want to step through the program then open it use the PGM (old style editor) instead of the Enhanced Editor. Then turn on the line numbers (if not already one). The submit the program step by step using the SUBTOP command add see which lines of code are clearing the log.
So for the example program you could start with SUBTOP 26 to get the macro variables and options defined. Then you could use SUBTOP 2 to run the first macro call. etc.
@jtran001 wrote:
Hi Tom, I checked all of those macros and none of them use a DM statement.
Does it consistently generate logs without the beginning? Is it always missing the same part?
As I said before if you really want to produce complete logs then do not run the programs interactively.
Try debugging by running step by step and examining the log window as you go to see if it is getting cleared.
Is it that the SAS log window has the full log, but the file that the DM command generates is missing the beginning?
Hi Shmuel, ballardw, and Tom,
I think I figured out what was causing the issue. After Shmuel suggested maybe the log was still held by the previous script/session/OS, I started checking for consistency uses of the last DM statement on the scripts. I found that some of the DM statement at the end of some of the scripts were modified by one of the analysts using
dm log 'print file = "K:\...\&mfolder\&measure.-Historic Data Run &memschema..log" replace' LOG;
instead of
dm 'log; file "K:\...\&mfolder\&measure.-Historic Data Run &memschema..log" replace';
Also, they didn't put the ods pdf close statement at the end of the script. So, when I submitted this one, it was okay until the subsequent scripts were submitted then the issue occurred. That's why it seemed so random.
I made the fix using the DM 'log; file ....log" replace'; and haven't seen the issue since.
Thank you all for taking the time to try helping me.
It is difficult to wnow without having the running code.
I suppose you have OPTIONS NOSOURCE at the begining of the code and somewhere later,
just before the code displayed in the log, there is: OPTIONS SOURCE.
Other possibility is using PROC PRINTTO LOG=... - in order to write the log to a file, and later
closing it with PROC PRINTTO; RUN;
If those are not the cases, please post full code and the full log of that code run.
Hi Shmuel, ballardw asked for the same thing as you. I attached a script and log in my response to ballardw. Would you please check them out there? Thank you.
I haven't find in your log, neither NOSOURCE nor PRINTTO strings,
but there are DM statements relation to LOG (lines 1, 574);
Are you running scripts in a chain? do you have the issue running a script as first action entering SAS session?
Maybe the issue is the result of previous running code - the 95 absent lines are written to the previous code log ?
On log line 574 you have:
dm log 'file "K:\HSE\HEDIS\&rptyr\documentation\measures\A P C\APC Numerator &memschema..log"
replace' log;
that makes me suspicious. Try to run the code without it or move it to the beginning.
Do you have different/unique log file names on each script?
Can it be that you are trying to write to a logfile that occasionally is still held by previous script/session/OS ?
Closing sas session should close all files open. Sometimes the OS is busy and thre is a delay in relaesing a file.
I have no more ideas and hope someone else will have.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.