BookmarkSubscribeRSS Feed
Ronein
Meteorite | Level 14

Hello

Let's say that I run macro code.

By looking at log window (When SAS didn't finish run)-

How can I know  which process SAS is currently running?

(V_months=2111+2110+2109+2108+2107+2106)

or

(V_months=2110+2109+2108+2107+2106+2105)

Should I add any code in order to look at Log window and understand better?

%macro RRR;
code
...
code
%mend RRR;
%RRR(V_months=2111+2110+2109+2108+2107+2106)
%RRR(V_months=2110+2109+2108+2107+2106+2105)
7 REPLIES 7
Ksharp
Super User
%macro RRR(V_months=);
%put WARNING: %nrstr(%%)&sysmacroname.( &=V_months. ) is running;
data _null_;
 set sashelp.class;
run;
%mend RRR;
%RRR(V_months=2111+2110+2109+2108+2107+2106)
%RRR(V_months=2110+2109+2108+2107+2106+2105)

Ksharp_0-1720516341899.png

 

yabwon
Onyx | Level 15

Just for fun:

%macro RRR(V_months=)/parmbuff;
%put WARNING- %nrstr(%%)&sysmacroname.&syspbuff. is running;
data _null_;
 set sashelp.class;
run;
%mend RRR;
%RRR(V_months=2111+2110+2109+2108+2107+2106)
%RRR(V_months=2110+2109+2108+2107+2106+2105)
_______________
Polish SAS Users Group: www.polsug.com and communities.sas.com/polsug

"SAS Packages: the way to share" at SGF2020 Proceedings (the latest version), GitHub Repository, and YouTube Video.
Hands-on-Workshop: "Share your code with SAS Packages"
"My First SAS Package: A How-To" at SGF2021 Proceedings

SAS Ballot Ideas: one: SPF in SAS, two, and three
SAS Documentation



Quentin
Super User

Hi,

 

This is a bit vague.   Can you add a bit more sample code to your example?  Do you want to know if the macro is running, or if a DATA step is running, or which iteration of a data step is running, or...

 

Also, what IDE are you using to submit SAS code (DisplayManager/PC SAS, Enterprise Guide, Studio?).

 

Typically the starting point might be %PUT or PUT statements.  But you might also consider more exotics stuff like using %WINDOW to pop up a message in Display manager, or using SYSECHO in EG, as in these blog posts from Chris Hemedinger:
https://blogs.sas.com/content/sasdummy/2009/05/26/tracking-progress-in-sas-programs-in-sas-enterpris...

https://blogs.sas.com/content/sasdummy/2013/01/30/tracking-progress-with-dosubl/

 

The Boston Area SAS Users Group is hosting free webinars!
Next webinar will be in January 2025. Until then, check out our archives: https://www.basug.org/videos. And be sure to subscribe to our our email list.
Ronein
Meteorite | Level 14
I want to know-
1-which macro is running?
In my example have 2 macros
2-which iteration of a data step is running,
yabwon
Onyx | Level 15

"2-which iteration of a data step is running," - where is data step in your example ?

_______________
Polish SAS Users Group: www.polsug.com and communities.sas.com/polsug

"SAS Packages: the way to share" at SGF2020 Proceedings (the latest version), GitHub Repository, and YouTube Video.
Hands-on-Workshop: "Share your code with SAS Packages"
"My First SAS Package: A How-To" at SGF2021 Proceedings

SAS Ballot Ideas: one: SPF in SAS, two, and three
SAS Documentation



Tom
Super User Tom
Super User

You can tell because those two statements (the macro calls) should be in the SAS log.

Trivial example:

1    %macro RRR(V_months);
2    /* code */
3    %mend RRR;
4    %RRR(V_months=2111+2110+2109+2108+2107+2106)
5    %RRR(V_months=2110+2109+2108+2107+2106+2105)

Or did you issue those macro calls as part of some other macro?

 

If you turn on MLOGIC you should see the values passed when the macro starts.  (although it will make you log much longer if you have complex macro logic).

1    %macro RRR(V_months);
2    /* code */
3    %mend RRR;
4    options mlogic;
5    %RRR(V_months=2111+2110+2109+2108+2107+2106)
MLOGIC(RRR):  Beginning execution.
MLOGIC(RRR):  Parameter V_MONTHS has value 2111+2110+2109+2108+2107+2106
MLOGIC(RRR):  Ending execution.
6    %RRR(V_months=2110+2109+2108+2107+2106+2105)
MLOGIC(RRR):  Beginning execution.
MLOGIC(RRR):  Parameter V_MONTHS has value 2110+2109+2108+2107+2106+2105
MLOGIC(RRR):  Ending execution.
yabwon
Onyx | Level 15

Just for fun, how about to have a cake and to eat a cake:

%macro RRR(V_months=);
options nomlogic;
/* code */
%do i =1 %to 100;
%end;
/* code */
options mlogic;
%mend RRR;

options mlogic;
%RRR(V_months=2111+2110+2109+2108+2107+2106)
%RRR(V_months=2110+2109+2108+2107+2106+2105)
options nomlogic;

Bart

_______________
Polish SAS Users Group: www.polsug.com and communities.sas.com/polsug

"SAS Packages: the way to share" at SGF2020 Proceedings (the latest version), GitHub Repository, and YouTube Video.
Hands-on-Workshop: "Share your code with SAS Packages"
"My First SAS Package: A How-To" at SGF2021 Proceedings

SAS Ballot Ideas: one: SPF in SAS, two, and three
SAS Documentation



SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

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
  • 7 replies
  • 927 views
  • 5 likes
  • 5 in conversation