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;
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.
With proc reg, you will need an extra datastep to create the quadratic terms variables before calling the procedure.
Give it a try yourself and come back here if you encounter problems. You will learn more that way.
@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;
As I mentioned above, you need an extra datastep to create the quadratic terms variables before calling the procedure.
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.