Desktop productivity for business analysts and programmers

SAS programming -- logging

Reply
N/A
Posts: 0

SAS programming -- logging

In the SAS documentation about log files, there is a section that provides special parameters/characters for log file names: like #A for the day of the week.

e.g. test_log.#A.#Y-#m-#d.#H.#M.#s.log

that should produce "test_log.Friday.2007-12-21.13.33.00.log"

Apparently this doesn't work for proc printto log="test_log..." ;
Is this true? or am I missing some option someplace?
I set -logparm "open=replace write=immediate rollover=session"
Am I SOL? or what?
SAS Super FREQ
Posts: 8,720

Re: SAS programming -- logging

Hi:
I believe that -logparm is an invocation option and that it works with the -log option. So if you have:
[pre]
sas -log "test%H%M.log" -logparm "rollover=session"
[/pre]

Then it is the -log option that is naming the LOG file. So that means that you will find a SAS log file under the -LOG option name -- using whatever directives you used in the option.

It would not be appropriate to then use PROC PRINTTO to redirect the LOG to a different name, because you would be redirecting it away from the name that the
-LOG option.

According to the doc for PROC PRINTTO, it says that:
PROC PRINTTO LOG=file-specification;
This procedure statement sends any following SAS log entries to the disk file associated with file-specification during a SAS session. The value for file-specification can be any valid external file specification discussed in Identifying External Files to SAS.


And if you look in the section referenced, there is no mention there of using directives to name the external file. It looks like the special directives (that start with % or #) are only allowed in the -LOG option.

You can check with Tech Support for more help on your logging issue. Perhaps if you explain to them the conditions under which you want to change the log name and which servers/operating systems are involved, they can help you further.

cynthia
N/A
Posts: 0

Re: SAS programming -- logging

I'm not entirely clear on the correspondent's specific needs, but if you want to create a date time stamped PrintTo log, then you run a procedure within the SAS session. It seems to me that you then have the power of the data step and the macro language to calculate the unique naming for the log file and have no need for the system level mnemonics.

Where I have a SAS session with a handful of included programs and I have a need for a session log containing all log data, and an individual program log for each program, I define an alternate log with the invocation option "-altlog" and then call the PrintTo procedure with names specific to the included program.

If you're running this under Enterprise Guide though, your project will already contain a complete set of step logs for the nodes you execute.

Kind regards

David
Ask a Question
Discussion stats
  • 2 replies
  • 110 views
  • 0 likes
  • 2 in conversation