Hello,
I ran a linera regression model to test the hypthesis that marginal cost for all the groups are equal. The estimated parameters are different among the groups. I need to test if the estimated parameters are equivalent to each other. If it is Wald test how can I write the code in SAS enterprise guide?
thanks in advance.
What PROC did you use? Can you show us the code?
proc reg data=egen.finaldataenergisteg1;
model InvestKArFP= AInBes1 AInBes2 AInBes3 AInBes4 AInBes5 AInBes6 AInBes8 AInBes9 AInBes10 AInBes11 ;
run;
quit;
Note that may dependent variable is investmentscost and the inpendent variables are dummy variables for energysaving for different groups. If it is group 1 (AInBes1) the dummy variable takes value 1 for group 1 and 0 otherwise. I have ten dummy variables for ten different groups.
I need to test if the estimated pratameters of the dummy variables are equal?
My understanding is this:
You want to test if the coefficient of dummy variable AInBes1 is equal to the coefficient of dummy variable AInBes2 and those are equal to the coefficient of dummy variable AInBes3 and so on ...
Is that correct?
If so, then you don't need dummy variables at all, you need the original category variable which has 11 levels, and which I will assume was named AInBes. Then you can do the test in PROC GLM
proc glm data=egen.finaldataenergisteg1;
class AInBes;
model investkarfp = AInBes;
means AInBes/t lines;
run; quit;
The test for AInBes is the test you want. If you find that this indicates significant differences between the levels of AInBes, then you can use the results from the MEANS command to determine which levels are different from which other levels.
I think we have got little missunderstaning here. Rather it might seem that I have made mistake in creating the variables. I have created AInBes1, AInBes2.......AInBes11 by multiplying the "energisaving" variable with different dummy variables to create an interaction variable. I mean I created dummy variable for each group and then created interaction variable by multiplying these dummy variables with the energisaving variable. And finally the AInBes1, AInBes2.......AInBes11 variables take values either a number for energisaving i kilowatthour or zero otherwise.
Minor change to the code I showed. This is what you want:
proc glm data=egen.finaldataenergisteg1;
class AInBes;
model investkarfp = energisaving*AInBes;
run; quit;
Again, you don't have to create dummy variables. The test for energisaving*ainbes is what you want.
I am sorry, I think I was not clear enough to describe my question. At first I want 10 different estimated coefficients för 10 different interaction variables and then I want to test if the estimated coefficients are significantly different from each other. I want to say something about if all the different groups had same marginal investment cost for energysavings measures.
One modification, if this doesn't do it, then you will need to describe further, please start by showing us a portion of the data BEFORE you created the dummy variables
proc glm data=egen.finaldataenergisteg1;
class AInBes;
model investkarfp = energisaving*AInBes/solution;
run; quit;
projekt | InvestKArFP | atg_rder | InvBesKWhAr | atgrd1 | atgrd2 | atgrd3 | atgrd4 | atgrd5 | atgrd6 | atgrd7 | atgrd8 | atgrd9 | atgrd10 | atgrd11 | AInBes1 | AInBes2 | AInBes3 | AInBes4 | AInBes5 | AInBes6 | AInBes8 | AInBes9 | AInBes10 | AInBes11 |
P47035-1 | 8045,358471 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | |||||||||||
P47087-1 | 75311,3264 | 2 | 1166000 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1166000 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
P47091-1 | 25745,14711 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | |||||||||||
P47092-1 | 22044,28221 | 1 | 24500 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 24500 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
P47197-1 | 1072264,759 | 3 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | |||||||||||
P47262-1 | 1101482,694 | 4 | 3500000 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3500000 | 0 | 0 | 0 | 0 | 0 | 0 |
P47275-1 | 177687,0544 | 5 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | |||||||||||
P47276-1 | 631983,1586 | 3 | 6600000 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 6600000 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
P47319-1 | 144008,6633 | 11 | 400000 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 400000 |
P47321-1 | 678855,2429 | 6 | 2500000 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2500000 | 0 | 0 | 0 | 0 |
P47422-1 | 13692,96844 | 2 | 70000 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 70000 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
P47442-1 | 15447,08826 | 1 | 640000 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 640000 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
P47535-1 | 852807,9979 | 1 | 18200000 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 18200000 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
P47701-1 | 25686,32256 | 9 | 78755 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 78755 | 0 | 0 |
P47702-1 | 157995,7897 | 2 | 1400000 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1400000 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
P47735-1 | 36716,08979 | 4 | 746000 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 746000 | 0 | 0 | 0 | 0 | 0 | 0 |
hi again,
I tried to share the part of the data and hope that u can help me now.
I would really like to see the data BEFORE the dummy variables were created, as I'm not going to use them.
Hello again,
InvestKArFP | atg_rder | InvBesKWhAr |
are my key variables. The atg_rder variable has values 1 to 11 indicating different measures. I created dummy variables from atg_rder variable taking value 1 if atg_rder is 1 and 0 otherwise, also taking value 1 if atg_rder is 2 and 0 otherwise and so on. Then by multiplying the dummy variables with InvBesKWhAr I created interaction variables.
Then I ran the regression as follows:
proc reg data=egen.finaldataenergisteg1;
model InvestKArFP= AInBes1 AInBes2 AInBes3 AInBes4 AInBes5 AInBes6 AInBes8 AInBes9 AInBes10 AInBes11 ;
run;
quit;
Finally I wanted to test if the coefficents of the interaction variables were significantly different from each other?
proc glm data=whatever;
class atg_rder;
model investKArFP = atg_rder*invbeskwhar/solution;
run; quit;
The effect for the interaction is the answer you are asking for.
Thanks a lot! Now i could get the estimated coefficients for the interaction variables. But what does the figure on analysis of Covariance of InvestKArFP variable mean? Can I say anything about if the estimated coefficients are significantly different from each other or not? Sorry that I don't know how to send the results so that you could exp
with best regards.
You can do a screen capture of the results and then include them in your reply using the "camera" icon (also known as the "insert photos" icon)
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.