Obsidian | Level 7

## PROC REG for full quadratic model

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
Opal | Level 21

## Re: PROC REG for full quadratic model

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
Obsidian | Level 7

## Re: PROC REG for full quadratic model

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

## Re: PROC REG for full quadratic model

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

PG
Obsidian | Level 7

## Re: PROC REG for full quadratic model

@PGStas, can you kindly show me how its done?
Opal | Level 21

## Re: PROC REG for full quadratic model

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

PG
Obsidian | Level 7

## Re: PROC REG for full quadratic model

@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;```
Opal | Level 21

## Re: PROC REG for full quadratic model

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

PG
Discussion stats
• 7 replies
• 1203 views
• 0 likes
• 2 in conversation