/* graf2 Daniel Brockman 070519 graph x and y variables ; */ %graf2(dsn,x,y,reg,line,style,file,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 * * reg =1 or Y or yes or TRUE means compute and draw linear * regression line and 95% confidence interval. * * line =1 or Y or yes or TRUE means connect the dots with a line * =otherwise means no line. * * style SAS html style * * file name of html file to encapsulate chart. * * 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; ods html style=&style file=&file ; * get temporary set names ; %getdsname(dsn); %let t2 = &greturn; data &t2 ; set &dsn ; if &vary ; run ; * remove missing obs ; * proc sort data=&t2 ; by &vary ; run ; * sort input ; * goptions ftext=swiss gsfmode=append rotate gprolog='%!' display ; * goptions device=gif ; title h=2 "&title"; footnote h=1 "&footnote"; proc gplot data=&t2 gout=&gcat; symbol1 %if (%upcase(&lin) %in(1,TRUE,YES,YE,Y) %then %do ; * if connect dots ; i=join %end; * if connect dots ; %if (%upcase(®) %in(1,TRUE,YES,YE,Y) %then %do ; * if reg line ; i=r CLI 95 %end; * if reg line ; h=1 v=circle c=blue; plot &x*&y / overlay name="&name." ; run; ods html close; title ; footnote ; * reinit ; * remove tempo datasets; %delds(&t2); %mend graf2;