BookmarkSubscribeRSS Feed
AXR
Calcite | Level 5 AXR
Calcite | Level 5

Hi, I am using the margins macro with a gamma distribution and a log link to output the average marginal effect of a continuous variable within levels of a categorical variable. When I run the macro, after some time, I get the following error. I believe this error is associated with the continuous variable (var3) in the effect statement because when I take it out the margins run without error for the categorical variable in the margins statement (var2).

SAS error 2020-07-13 212813.png

 

I use the following code:

%Margins(data = dat,
			response = var1,
			model = var2|var3  var2|var4 var2|var5 var6-var12
			effect = var3,
			margins = var2,
			class = var2 var5 var6 var_id,
			dist = gamma,
			link = log,
			geesubject = var_id,
			geecorr = ind,
			options = diff cl);

 

4 REPLIES 4
ChrisNZ
Tourmaline | Level 20

I have no idea what the margins macro is. 

That macro is trying to store too many values in a macro variable.

If storing this many values is justified (is it?), you need to alter the macro so it does not use a macro variable to pass a list of values.

 

ChrisNZ
Tourmaline | Level 20

I suppose it's this macro: https://support.sas.com/kb/63/038.html

Try replacing line

%let _version = 1.05;

with

%let _version = DEBUG;

to see where the error takes place so you can work there.

AXR
Calcite | Level 5 AXR
Calcite | Level 5

Hi @ChrisNZ thanks for your response.

 

Unfortunately, changing the macro code to DEBUG didn't change anything. I get the same error message.

ChrisNZ
Tourmaline | Level 20

Read my message again

 

Try replacing ... to see where the error takes place 

You need to change how the macro works. So you need to investigate where the macro variable is used.

DEBUG will some of the macro's workings and help you do that.

DEBUG2 will display even more.

 

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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
  • 4 replies
  • 675 views
  • 0 likes
  • 2 in conversation