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

Hello,

 

I have some troubles for run a macro.

 

I put several macros (that work) in a big macro and I tried to run it but nothing is happening ...

 

I have check :

- the comments (all my comments are like /* my comment */ )

- I have try to close SAS and open again but still not working

- names of each macro it's ok, like :

%Macro BIG_ONE ;

  %Macro macro1 ;
  /* ..... */
  %Mend macro1 ;

  %Macro macro2 ;
  /* ...... */
  %Mend macro2 ;

  %Macro macro3 ;
  /* ... */
  %Mend macro3 ;

%Mend BIG_ONE ;

%BIG_ONE ;
I put the options mprint, mlogic and symbolgen and I don't see any problem on the log (I have watched every line of the log one by one).
 
Someone has an idea ?
 
Thank you a lot !
 
Onizuka
 
PS : Sorry for my english..
 
 
1 ACCEPTED SOLUTION

Accepted Solutions
Tom
Super User Tom
Super User

All you did was define a bunch of macros.  I do not see any statements that would call any of them.

There is no reason to define macros inside of other macros.  The name space for compiled macros is flat so whether you define MACRO1 inside of BIG_ONE or outside of BIG_ONE there can only ever be one compiled version of MACRO1.

 

This type of structure is more logical.

%Macro macro1 ;
  /* ..... */
%Mend macro1 ;

%Macro macro2 ;
  /* ...... */
%Mend macro2 ;

%Macro macro3 ;
  /* ... */
%Mend macro3 ;

%Macro BIG_ONE ;

%macro1;
%macro2;
%macro3;

%Mend BIG_ONE ;

%big_one;

Now when you call %BIG_ONE it calls the other three macros in sequence.

View solution in original post

5 REPLIES 5
Tom
Super User Tom
Super User

All you did was define a bunch of macros.  I do not see any statements that would call any of them.

There is no reason to define macros inside of other macros.  The name space for compiled macros is flat so whether you define MACRO1 inside of BIG_ONE or outside of BIG_ONE there can only ever be one compiled version of MACRO1.

 

This type of structure is more logical.

%Macro macro1 ;
  /* ..... */
%Mend macro1 ;

%Macro macro2 ;
  /* ...... */
%Mend macro2 ;

%Macro macro3 ;
  /* ... */
%Mend macro3 ;

%Macro BIG_ONE ;

%macro1;
%macro2;
%macro3;

%Mend BIG_ONE ;

%big_one;

Now when you call %BIG_ONE it calls the other three macros in sequence.

Onizuka
Pyrite | Level 9

@Tom wrote:

All you did was define a bunch of macros.  I do not see any statements that would call any of them.


Yes, it is what I thought.. We must believe that at the end of the day it becomes difficult lol

 

Thank you 😛

Onizuka
Pyrite | Level 9

You're right, what I wanted to do is nonsense, so I removed the "BIG_ONE" and added a code which directly run all the macros like :

 

%Macro RUN_GESTION_RECUL (typequest =) ;

	%local i ;
	%do i = 1 %to %sysfunc(countw(&typequest));
		%let nextvar = %scan(&typequest,&i.);

		%comptage_niveau   ;
		%calcul_periode    ;
		%traitement_recul  ;
		%ajout_niveau_base ;

	%end ;

%Mend RUN_GESTION_RECUL ;

Thanks for your answer 🙂

Onizuka
Pyrite | Level 9

1h searching for an answer and I think that is because i don't put :

 

%macro1 ;

%macro2 ;

%macro3 ;

 

I come back tomorrow ..

kulbshar
Calcite | Level 5

what do you mean nothing is happening? nothing is mentioned in the macro except comments so what you expecting to happen?

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 5 replies
  • 489 views
  • 0 likes
  • 3 in conversation