Hi all, I would like to run a regression using proc surveyreg with a list of indicator variables (i.e., fixed effects). The procedure seems to treat the last group as the benchmark by default, but I would like to use another group as a benchmark. Is there any way to do so? For example, USA is the benchmark group when I run the following code, which I don't want.
proc surveyreg data= sashelp.cars ; class origin; model EngineSize= Horsepower MPG_City MPG_Highway Weight Wheelbase Length origin / solution; run;
I noticed that there is one way. It says that I need to get my variable formatted, which would take quite a lot of time: https://communities.sas.com/t5/SAS-Procedures/Changing-reference-level-for-categorical-variable-in-P...
I really hope that there is easier way to do so! Thanks!
Thanks, but it didn't work.
proc surveyreg data= sashelp.cars ; class origin (ref="LEVEL"); model EngineSize= Horsepower MPG_City MPG_Highway Weight Wheelbase Length origin / solution; run;
You need to replace LEVEL with the level you want, in this case USA
Like this?
proc surveyreg data= sashelp.cars ; class origin (ref="Asia"); model EngineSize= Horsepower MPG_City MPG_Highway Weight Wheelbase Length origin / solution; run;
As below, error is detected with "(".
4290 proc surveyreg data= sashelp.cars ;
4291 class origin (ref=Asia);
-
22
76
NOTE: The previous statement has been deleted.
ERROR 22-322: Syntax error, expecting one of the following: a name, ;, -, :, _ALL_, _CHARACTER_,
_CHAR_, _NUMERIC_.
ERROR 76-322: Syntax error, statement will be ignored.
4292 model EngineSize= Horsepower MPG_City MPG_Highway Weight Wheelbase Length origin / solution;
4292! run;
ERROR: Variable Origin should be either numeric or specified in the CLASS statement.
NOTE: The previous statement has been deleted.
ERROR: No MODEL statement.
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE SURVEYREG used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds
Still, doesn't work.... I saw a post saying that it may work for surveylogistic, but not for surveyreg.
Thanks. I use SAS 9.4. Could you please post your code (using sashelp.cars) if it worked for you?
Your SAS version can have different SAS/STAT modules/versions installed.
You can find your version by running the following and checking your log.
proc product_status;
run;
By the way, my preferred benchmark is actually the FIRST one. Can I make my SAS use FIRST as a benchmark, instead of LAST? It would help.
class origin (ref = LAST);
If you want to use the last in the order as your reference, which implies last alphabetically by the way, not via data order.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.