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 secondsStill, 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.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.
Ready to level-up your skills? Choose your own adventure.