An Idea Exchange for SAS software and services

by Super User
on ‎01-05-2018 11:06 AM

Wouldn't comments or PUT statements accomplish this task?

by Super User
on ‎01-05-2018 11:27 AM

Is this intended to provide "groups" for non-contiguous code? Because I am having a hard time visualizing what you may get if the code isn't contiguous.


Or does this have something to do with macros as the default behavior of macro generated code doesn't provide an automatic description of which macro was running when looking at the log?


I have in some jobs that had many macros or complex interactions of macro added:


%put Starting Macro: ThisMacroName with parameters:  <parameter list>;

<all the actual macro code>

%put Ending Macro ThisMacroName;


You can add WARNING: , ERROR: or NOTE:  to the beginning of the phrase to get color highlights in the Log.

by Contributor TimH
on ‎01-05-2018 11:27 AM

Comments and put statements work for reviewing the code or the SAS log,  but  would _not_ externalize the grouping to the SMF record or other logging record used for measuring SAS utilization.  I am, admittedly, primarily a mainframe user of SAS so SMF is important.  

by Contributor TimH
on ‎01-05-2018 11:35 AM

This has nothing to do with macros or 'non-contiguous' code -  it's just a text descriptor, my primary focus (as stated above) is to get it externalized to logs where analysis of a big SAS program's use of resources.  For example, I have a program that uses 6 minutes of CPU time.  I'd like to be able to analyze the SAS SMF records and see not just 'PROC REPORT' but that it was specifically the 'PROC REPORT' for 'SUMMARY BY GROCERY BAGGER NAME'  that used the CPU.

by Regular Contributor
on ‎01-05-2018 06:15 PM

Give examples.

by Contributor TimH
on ‎01-06-2018 10:35 AM

/* example of what I'm talking about syntax not checked and dumb code purely for exampl */

DATA Eastern (KEEP=Store Sales WHERE=(Region='Eastern')) / DESC='Summarizing eastern region'; SET AllStores;

PROC SORT DATA=Eastern DESC='Summarizing eastern region'; BY Store;

PROC MEANS DATA=Eastern NOPRINT DESC='Summarizing eastern region';

     CLASS Store;

    VAR Sales;

     OUTPUT Out=SumEast


DATA Western (KEEP=Store Sales WHERE=(Region='Western')) / DESC='Summarizing western region'; SET AllStores;

PROC SORT DATA=Western DESC='Summarizing western region'; BY Store;

PROC MEANS DATA=Western NOPRINT DESC='Summarizing western region';

     CLASS Store;

    VAR Sales;

     OUTPUT Out=SumWest


SO - in the SMF records, not only would we have the JOB name, the STEP, and the records that say "DATA step" or the procedure name, we'd have an identifier that would tell us what 'group' of code.   I don't know if other platforms have ways of logging resource use by SAS programs but if they do, then this would be helpful there as well.  This information would help immensely when trying to improve the performance of production SAS code.

by Super Contributor
on ‎01-16-2018 10:56 AM

Take it bit further, please (for all OS platforms) -- while executing/defined, also populate an AUTOMATIC variable (with the user-declared DESC="<your_useful_description_goes_here>")  which can be interrogated (for example in a common SAS macro) for the purpose of conditional execution code-path.  I do this today with the executing USERID, allowing conditional SAS logic execution at session start-up.

Scott Barry
SBBWorks, Inc.

by New User Giuseppegiacomo
on ‎01-16-2018 11:43 AM

I agree with the proposal

by Regular Contributor
on ‎01-17-2018 10:38 AM

I wonder if this could be made a function of PROC PRINTTO.   (not OUTPUT)

by Regular Contributor
‎01-17-2018 10:44 AM - edited ‎01-17-2018 10:46 AM

So would this produce output to a log similar to what you are proposing:

%LET DESC=Merge all files;

DATA foobar;  merge S N A F U;


...just without macro commands?


Idea Statuses
Top Liked Authors