Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

filename automation 1

Status
Not open for further replies.

nickbrookes

Technical User
May 12, 2001
20
0
0
GB
I am proc printto ing logfiles and would like to assign the filenames based on the time() function rather than the &systime function but am having trouble getting sas to assign the filename for me.

what i would like the filename to be is

c:\temp\logfile_123456.log if it is 12:34 and 56 seconds.

Can anyone help?

Cheers
 
Hi,

Try this:

Code:
data _null_;
  x = time();
  y = compress (put (x, TIME8.), ':');
  call symput ('TT', trim(y));
run;
%put &TT.;

filename mylog "c:\temp\timed_log_&TT..log";

proc printto log=mylog; run;

data _null_;
   put 'Into the log file';
run;

proc printto; run;

data _null_;
   put 'Back on screen';
run;

Cheers,
Matthias
 
I notice that SAS log files can be saved to a file using something like this
Save your LOG file to a specific directory or filename:1
proc printto log="[mydir]filename.log new;
run;

Is it possible to save the log file as a SAS dataset? In a lot of our processes we save the ouput from the SAS programs as a multi-tab excel file and I was wondering whether the log file can be saved as a SAS dataset, so I could export it with the ouput.

QueryMan

 
Hi Queryman,

your problem will be the columns of the spreadsheet - fixed width wouldn't work, tabs are not in the log. So how do you ideally spread the values into the columns?

I think you more have to go into scanning/parsing the saved log, then extracting information you want and store in tables. For example you could scan execution time of each datastep step. Ot you go one line into one variable and store a lineno variable as well.

I started a share server log analysis tool where I exactly did that: I read and parsed each server log line and placed in in a set of SAS tables.

Cheers,
Matthias
 
Hi Matthias,
I read this on a web site
(Alternatively, if you are disseminating reports
electronically, have your SAS
programs save the log
window output to a dated text file.) You can’t
document all programming points in your titles and
footnotes, and there is no substitute for having the
actual log for review when you get the inevitable
questions about the exact report specifications that
you used.

Is there a way to export the log as is w/o parsing, extracting to maybe a word document that we could attach to the final report?

QueryMan

 
Hi Queryman,

I suggest using the startup option "altlog" then, or you do the above "proc printto". There is no problem to place this ASCII flatfile text into MS Word, or attach to an overnight job email.

Cheers,
Matthias
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top