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

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);

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

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

View solution in original post

8 REPLIES 8
Reeza
Super User

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

Peter_C
Rhodochrosite | Level 12

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

ballardw
Super User

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

Jagadishkatam
Amethyst | Level 16

Another way of writing the dm code is as below

dm 'clear log';

dm 'clear output';

Thanks,

Jagadish

Thanks,
Jag
SuneelReddy
Fluorite | Level 6

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

desireatem
Pyrite | Level 9

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

Reeza
Super User

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

kaji
Fluorite | Level 6

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!

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
  • 8 replies
  • 67790 views
  • 9 likes
  • 7 in conversation