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);
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
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
ods noresults
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
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
Another way of writing the dm code is as below
dm 'clear log';
dm 'clear output';
Thanks,
Jagadish
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
Ladies and Gentlemen, Thanks, now I know many ways to clear both the log and output files
You can mark this question (and others) as answered as well.
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!
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.