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.
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!
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.