BookmarkSubscribeRSS Feed
JUMMY
Obsidian | Level 7

How do I write a prediction equation only for the full quadratic model that contains the two linear terms (main effects), the two quadratic terms, and the interaction using PROC REG for the data below?

 

data brand;
	input preference moisturecontent sweetness @@;
	datalines;
	64 4 2 73 4 4 61 4 2 76 4 4 72 6 2 80 6 4 
	71 6 2 83 6 4 83 8 2 89 8 4 86 8 2 93 8 4
	88 10 2 95 10 4 94 10 2 100 10 4
	;
run;
proc print;
run;

proc reg data=brand;
 model preference=moisturecontent sweetness;
 by make;
run;
7 REPLIES 7
PGStats
Opal | Level 21

Get the regression estimates from:

 


proc rsreg data=brand;
 model preference=moisturecontent sweetness / nooptimal;
run;


Use

 

ODS OUTPUT parameterEstimates=myEstimates;

 

to transfer the estimates to a dataset.

PG
JUMMY
Obsidian | Level 7
@PGStats, how do I use PROC REG instead of PROC RSREG?
PGStats
Opal | Level 21

With proc reg, you will need an extra datastep to create the quadratic terms variables before calling the procedure.

PG
JUMMY
Obsidian | Level 7
@PGStas, can you kindly show me how its done?
PGStats
Opal | Level 21

Give it a try yourself and come back here if you encounter problems. You will learn more that way.

PG
JUMMY
Obsidian | Level 7

@PGStats , I tried the code below:

 

proc reg data=one;
 model preference=moisturecontent*moisturecontent sweetness*sweetness 
							moisturecontent*sweetness;
run;

And keep getting this error:

10   proc reg data=one;
11    model preference=moisturecontent*moisturecontent sweetness*sweetness
                                      -
                                      22
                                      76
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.
12                               moisturecontent*sweetness;
NOTE: The previous statement has been deleted.
13   run;
PGStats
Opal | Level 21

As I mentioned above, you need an extra datastep to create the quadratic terms variables before calling the procedure.

PG

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

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!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 7 replies
  • 2588 views
  • 0 likes
  • 2 in conversation