How do I automatically clear log and output

Reply
Super Contributor
Posts: 292

How do I automatically clear log and output

How can I clear the log and output so that I do not stay by my pc ;


ods listing close;

macro surv(iterations=);

%do p=1 %to &iterations;

data test_&p;

seed = -1;
alpha1 =
2.50;
beta1 =
9.50;
do i =
1 to 100 
lambdaT =
0.082; *baseline hazard; 
lambdaC=
0.400001;

      er=0.00+sqrt(0.00001)*rannor(0); *error dist
N(0.00,0.00001);

 
t = rand(
"WEIBULL", 1, lambdaT); * time of event;

  
c = rand(
"WEIBULL", 1, lambdaC) ;* time of censoring;

  
time = min(t, c);   
* which came
first?
 
censored = (c lt t);

      obs=(t lt c); * creating
observation variable from censored when observeed obs=1;

      y= alpha1+beta1*t+ er; 
output;

end;

run;

proc sort data=test_&p;

by time;

run;

proc means data = test_&p sum;

     where obs = 0;

    var censored;  

ods output summary = summary_&p;

run;

data cenN;

set summary_1-summary_&p;

run;

/***** MI*******/

proc freq data=test_&p ;

table censored;

ods output OneWayFreqs= cen_&p;

run;

data censored;

set cen_1-cen_&p;

run;

%end;

%mend surv;

%surv(iterations=1000);

Grand Advisor
Posts: 17,337

Re: How do I automatically clear log and output

Look into proc printo - redirects the log to a file

Options nonotes - supresses notes to the logs, except warnings and error messages

ODS listing close; - you're already using Smiley Happy

ods noresults

Valued Guide
Posts: 2,174

Re: How do I automatically clear log and output

alternatively, run the program in batch

create an icon with the regular sas.exe in the comand line along with the program name, like

".......relevant...path"\sas.exe  -sysin "your program.sas"

ensuring the "Start in" folder points to the folder of your program

then just double-click the icon

It should not need the -config option defined

sorry, forgot to refer to the program on the command line

Grand Advisor
Posts: 10,210

Re: How do I automatically clear log and output

the program statement:

dm 'log;clear;output;clear;';

will clear those.

If you need the ODS Results cleared as well add

odsresults;select all;clear;

within the single quotes or use another DM statement

Super User
Posts: 1,111

Re: How do I automatically clear log and output

Another way of writing the dm code is as below

dm 'clear log';

dm 'clear output';

Thanks,

Jagadish

Thanks,
Jag
Occasional Contributor
Posts: 7

Re: How do I automatically clear log and output

Hi,

Please use the below before writing the code

"dm 'log;clear;output;clear';" it will clear the log and output as well once you executed the program.

REgards

Suneel Reddy

Super Contributor
Posts: 292

Re: How do I automatically clear log and output

Ladies and Gentlemen, Thanks, now I know many ways to clear both the log and output files

Grand Advisor
Posts: 17,337

Re: How do I automatically clear log and output

You can mark this question (and others) as answered as well.

Occasional Contributor
Posts: 13

Re: How do I automatically clear log and output

Hi,

 

I found a pretty cool add-in to Base SAS on www.tatesoft.com that may be very usefull to you. The tool called Log Analyser is integrated into Base SAS and can produce Log summary report in a second. You may also analyse log in details if you wish. Really great tool!

Ask a Question
Discussion stats
  • 8 replies
  • 4880 views
  • 6 likes
  • 7 in conversation