Data visualization with SAS programming

I need help reproducing a response surface plot.

Reply
Occasional Contributor
Posts: 9

I need help reproducing a response surface plot.

Hello,

Please I need help reproducing a response surface plot. Please find attached below my data and SAS codes. I have attached the plot I would like to reproduce and the plot I get.

 

title ’Response Surface with a Simple Optimum’;

data RSM;

input Dose Time P_DTTAO;

cards;

0 7 0.7

0 7 0.4

0 7 1.2

0 7 1.1

0 7 0

0 7 0.4

8 7 1.9

8 7 2.3

8 7 0.7

8 7 2.1

8 7 3.2

8 7 0.2

12 2 3.3

12 2 2.5

12 2 2.6

12 2 2.6

12 2 3.0

12 2 1.0

12 12 0.4

12 12 1.0

12 12 0.9

12 12 1.5

12 12 0.3

12 12 0.4

4 2 1.0

4 2 1.2

4 2 -0.3

4 2 0.8

4 2 0.3

4 2 1.3

4 12 1.1

4 12 -0.1

4 12 0.1

4 12 -0.3

4 12 0.7

4 12 0.3

8 7 1.5

8 7 1.7

8 7 0.5

8 7 0.4

8 7 1.6

8 7 1.3

16 7 2.6

16 7 2.4

16 7 1.6

16 7 4.4

16 7 2.4

16 7 0.8

;

run;

data rsm2;

do;

Odor = . ;

do Time = 0 to 12 by 2;

do Dose= 0 to 16 by .05;

output;

end;

end;

end;

data rsm2;

set rsm rsm2;

run;

proc rsreg data=rsm2 out=predict noprint;

model P_DTTAO=Dose Time/ predict;

run;

 

ods graphics / attrpriority=none width=8in noborder;

 

ods escapechar='^';

 

ODS RTF FILE='/folders/myfolders/ODS Graphics/drug plot.rtf';

data plot;

set predict;

proc g3d data=predict;

plot Time*Dose=P_DTTAO / rotate=38 tilt=75 xticknum=6 yticknum=4

zmax=6 zmin=-2.17;

run;

ODS RTF CLOSE;

  Thank you

SAS Super FREQ
Posts: 3,620

Re: I need help reproducing a response surface plot.

The simplest way to get a 3D plot of the response surface is to let PROC RSREG generate it automatically through ODS graphics:

 

ods graphics on;
proc rsreg data=rsm2 out=predict plots=surface(3D);
   model P_DTTAO=Dose Time/ predict;
run;

If for some reason that is not sufficient, then use the following code to produce the plot by using PROC G3D. Note that I've used a grid that is more balanced than yours in terms of the X and Y locations of the grid points:

 

data rsm2;
P_DTTAO = . ;
do Time = 0 to 12;
   do Dose= 0 to 16 by .1;
      output;
   end;
end;
run;
data rsm2;
set rsm rsm2;
run;
proc rsreg data=rsm2 out=predict noprint;
model P_DTTAO=Dose Time/ predict;
run;

proc g3d data=predict;
plot Time*Dose=P_DTTAO / rotate=38 tilt=75 xticknum=6 yticknum=4
zmax=6 zmin=-2.17;
run;
Ask a Question
Discussion stats
  • 1 reply
  • 97 views
  • 0 likes
  • 2 in conversation