BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
jtran001
Fluorite | Level 6

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.

1 ACCEPTED SOLUTION

Accepted Solutions
jtran001
Fluorite | Level 6

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.

View solution in original post

19 REPLIES 19
ballardw
Super User

It would likely help to show 1) the code that generates the issue and 2) a log from running that code.

jtran001
Fluorite | Level 6

Hi ballardw, I've attached the script & log for your references.  The strange thing this issue occur at random.

Tom
Super User Tom
Super User

If you want to have a clean SAS log file then 

  1. Remove the DM commands from the program(s).
  2. Submit the job from the command line (batch mode) instead of running it interactively.

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
Fluorite | Level 6
Hi Tom, I checked all of those macros and none of them use a DM statement.
Tom
Super User Tom
Super User

@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?

jtran001
Fluorite | Level 6

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.

Shmuel
Garnet | Level 18

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.

 

 

jtran001
Fluorite | Level 6

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.

Shmuel
Garnet | Level 18

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.

jtran001
Fluorite | Level 6
Hi Shmuel - This issue occurs recently since the SAS v9.4 upgrade. The dm log on line 574 you cited had always been in the script. The one that's new is the DM statement at the top.

I submitted the scripts one after another in multiple SAS sessions. When one finished, I closed that session, started a new one to submit a new script. The issue happens at random. Sometimes I don't have the issue running a script as the very first one in a first SAS session. Sometime I do like now.
Shmuel
Garnet | Level 18

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 ?

jtran001
Fluorite | Level 6
Hi Shmuel - yes, I do have unique log file names on each script. If the issue is caused by being help by previous script/session, then is there a way to release it?

I rebooted my computer this morning, opened a new SAS session, removed the DM line at the top, submitted only one script; but the issue still occur.
Shmuel
Garnet | Level 18

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.

jtran001
Fluorite | Level 6
Thank you Shmuel for trying.

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 19 replies
  • 2756 views
  • 0 likes
  • 4 in conversation