/* graf2a Daniel Brockman 070519 graph x and y variables */ %macro graf2a(dsn,x,y,reg,line,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. * * 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; %put graf2a.sas L39 test ; * get temporary set names ; %getdsname(dsn); %let t2 = &greturn; data &t2 ; set &dsn ; if &x ; if &y ; run ; * remove missing obs ; * 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 %let j = %upcase(&line) ; %if (&j=1 OR &j=TRUE OR &j=YES OR &j=YE OR &j=Y) %then %do ; /* if join dots */ i=join %end; /* if join dots */ %let j = %upcase(®) ; %if (&j=1 OR &j=TRUE OR &j=YES OR &j=YE OR &j=Y) %then %do ; /* if reg line */ i=rlcli95 %end; /* if reg line */ h=1 v=circle c=blue; * end of symbol clause; plot &x*&y / overlay name="&name." ; run; title ; footnote ; * reinit ; * remove tempo datasets; %delds(&t2); %mend graf2a; ;