/* grafg3d Daniel Brockman 070522 graph x1, y and z variables */ %macro grafg3d(dsn,x,y,z, xmn,xmx,xtn,ymn,ymx,ytn,zmn,zmx,ztn, title,footnote,name,gcat) ; /* * dsn is the name of the input data set * * x is the variable to plot on the x-axis * * y is the variable to plot on the y-axis * * z is the variable to plot on the z-axis * * xmn is the min value on the x-axis (see proc g3grid) * xmx is the max value on the x-axis (see proc g3grid) * xtn is the number of ticks on the x-axis(see proc g3d) * * ymn is the min value on the y-axis (see proc g3grid) * ymx is the max value on the y-axis (see proc g3grid) * ytn is the number of ticks on the y-axis(see proc g3d) * * zmn is the min value on the z-axis (see proc g3grid) * zmx is the max value on the z-axis (see proc g3grid) * ztn is the number of ticks on the z-axis(see proc g3d) * * title A title for the chart * * footnote A footnote for the chart * * name name to attach to chart (see name plot option of proc gplot) * * gcat Output graphic catalog (gout) * * Choose the name of gcat as you would a dataset name. */ %global greturn; %local t1 t2 i j k; %local reg lin; %local anno; %getdsname(temp); %let anno=&greturn; %local grid; %getdsname(temp); %let grid=&greturn; %local grid2; %getdsname(temp); %let grid2=&greturn; * get temporary set names ; %getdsname(dsn); %let t2 = &greturn; data &t2 ; set &dsn ; if (missing(&x) or missing(&y) or missing(&z)) then delete ; run ; * remove missing obs ; * goptions ftext=swiss gsfmode=append rotate gprolog='%!' display ; * goptions device=gif; title h=2 "&title"; footnote h=1 "&footnote"; proc g3grid data=&t2 out=&grid; grid &x*&y=&z / spline smooth=.001 axis1=&xmn to &xmx by 1 axis2=&ymn to &ymx by 1 ; run; proc g3d data=&grid gout=&gcat; plot &x*&y=&z / name="&name." /*annotate=&anno */ zmax=&zmx zmin=&zmn zticknum=&ztn yticknum=&ytn xticknum=&xtn side ctop=red cbottom=grey; label Hour="Time of Day" ; ; run; title ; footnote ; * reinit ; * remove tempo datasets; %delds(&t2); %delds(&anno); %delds(&grid); %delds(&grid2); %mend grafg3d; ;