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

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;

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
PaigeMiller
Diamond | Level 26

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

5 REPLIES 5
PaigeMiller
Diamond | Level 26

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
mragaa
Obsidian | Level 7

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.

mragaa
Obsidian | Level 7

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.

PaigeMiller
Diamond | Level 26

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
mragaa
Obsidian | Level 7

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. 

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 1519 views
  • 2 likes
  • 2 in conversation