DATA Step, Macro, Functions and more

PROC GENMOD LS-Means differences.. what are they saying of the mean dollars?

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 17
Accepted Solution

PROC GENMOD LS-Means differences.. what are they saying of the mean dollars?

[ Edited ]

Hi everyone,

 

Challenge:  I wanna get the differences in revenues between different management types, in different regions and time periods. 

 

Problem: These are the LS-Means tables and the code I used to get them. I'm interested in the estimate in Table 1 (red), but I'm not sure what it means in terms of dollar revenues (blue) in Table 2? I understand it's the difference in the estimate but, admittedly, I don't get what the estimate refers to, as I look to the mean in dollars.

 

SAS version: 9.4

 

Thanks a lot.

 

 

 

 

 

Table 1: Differences of Period*Management*Region Least Squares Means
PeriodManagementRegion_Period_Management_RegionEstimateStandard Errorz ValuePr > |z|AlphaLowerUpper
313312-0.60190.02224-27.07<.00010.05-0.6455-0.5583

 

 

 

Table 2: Period*Management*Region Least Squares Means
PeriodManagementRegionEstimateStandard Errorz ValuePr > |z|AlphaLowerUpperMeanStandard ErrorLower MeanUpper Mean
 
3135.79280.01699340.89<.00010.055.75955.8262327.945.5729317.2339.05
3126.39480.0144444.09<.00010.056.36656.423598.78.6211582.04615.84

 

 

 

Code:

 

proc genmod data=test order=formatted;

 

class  Store Period Management Region / desc param=glm;

 

model Revenue = Management Period Region Management*Period*Region  /link=log dist=gamma;

 

   repeated subject=Store/type=ind;

 

lsmeans Management Region Period Management*Period*Region /ilink lines means diff cl;

 

slice Management*Period*Region /nof ilink sliceby=Management diff exp cl;

 

run;

 

 

 


Accepted Solutions
Solution
‎03-31-2018 01:49 PM
Respected Advisor
Posts: 2,812

Re: PROC GENMOD LS-Means differences.. what are they saying of the mean dollars?

The values you see under "Estimate" in both tables are transformed to different units by the log transformation. To understand the values in real units, you have to reverse the transformation.

--
Paige Miller

View solution in original post


All Replies
Solution
‎03-31-2018 01:49 PM
Respected Advisor
Posts: 2,812

Re: PROC GENMOD LS-Means differences.. what are they saying of the mean dollars?

The values you see under "Estimate" in both tables are transformed to different units by the log transformation. To understand the values in real units, you have to reverse the transformation.

--
Paige Miller
Occasional Contributor
Posts: 17

Re: PROC GENMOD LS-Means differences.. what are they saying of the mean dollars?

[ Edited ]
Posted in reply to PaigeMiller

Thank you, Paige. This is a helpful one step closer. I reversed the natural log and it works for the means but, unfortunately, not for the difference.

 

 Natural log (the estimates from the model)Exp (reversing the natural log from the left column)Means (How it should be, per the means column)
Region 26.394760638598.7598.7
Region 35.792830665327.94327.94
    
Difference0.6019299731.825639270.76
 -0.601929970.547753

 

As you can see, the difference is not reverting back to how it should be. I tried both the negative and the absolute values and it still misses the mark. So I have two follow up questions if you don't mind:

 

- Should I be reversing the difference in a different way?

- Is there a way for SAS to just give me the numbers I'm looking for (in dollars here) instead of their natural logarithm?

 

Thank you.

Occasional Contributor
Posts: 17

Re: PROC GENMOD LS-Means differences.. what are they saying of the mean dollars?

[ Edited ]

Follow-up: I got the first question. The difference here is the natural log of the percentage of (Region 3 mean) to (Region 2 mean).

(54.77% , -0.60193).

 

This leaves the second question open: Is there a more straightforward way? Am I doing something wrong?

 

Thank you.

Respected Advisor
Posts: 2,812

Re: PROC GENMOD LS-Means differences.. what are they saying of the mean dollars?

I think your final answer is correct. Is there a different way? Not off the top of my head, because the log of a difference is not equal to the difference of the logs.

--
Paige Miller
Occasional Contributor
Posts: 17

Re: PROC GENMOD LS-Means differences.. what are they saying of the mean dollars?

[ Edited ]
Posted in reply to PaigeMiller

Thank you, Paige. You've been most helpful as always.

 

To All: I'll leave my earlier wrong post up there so the evolution of thought is complete for others in the community. If it's preferable to just keep the right answer, please feel comfortable to let me know. 

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 5 replies
  • 132 views
  • 2 likes
  • 2 in conversation