%let gpath='.'; ods html close; %let dpi=200; ods listing gpath=&gpath image_dpi=&dpi; /*--Generate visit data--*/ data visit; format Date date7.; length Hospitalized $1; do date='06Sep76'd to '31Jan94'd by 28; visits=floor(max(9*ranuni(2)-5, 0)); hosp=0; if visits >2 then hosp=floor(ranuni(2)+0.3); Hospitalized=''; if hosp > 0 then Hospitalized='^'; output; end; run; /*--Convert multiple visits to dots--*/ data dots; label y='Visits'; length firstdate lastdate $12; set visit end=last; keep date y Hospitalized firstdate lastdate ylbl; retain ylbl 5; firstdate=''; lastdate=''; do y=1 to visits; if y > 1 then hospitalized=''; output; end; if _n_= 1 then do; firstdate=cat('<---', put(date, date7.)); output; end; if last then do; lastdate=cat (put(date, date7.), '--->'); output; end; run; ods html; proc print;run; ods html close; /*--Dot Plot--*/ ods listing image_dpi=200; ods graphics / reset noborder attrpriority=color width=6in height=0.7in imagename='Visits_Dot_4'; title j=l 'Family name, Given name' j=r 'County Clinic'; proc sgplot data=dots noautolegend noborder nowall; scatter x=date y=y / markerattrs=(symbol=circlefilled size=5); xaxistable hospitalized / x=date nomissingchar labelattrs=(size=9 weight=bold) valueattrs=(size=10 weight=bold); text x=date y=ylbl text=firstdate / position=right contributeoffsets=none; text x=date y=ylbl text=lastdate / position=left contributeoffsets=none; xaxis type=time values=('01jan1980'd '01jan1985'd '01jan1990'd '01jan1995'd) valueshint display=(nolabel) valuesformat=year. valueattrs=(size=9 weight=bold); yaxis display=(noline noticks novalues) labelattrs=(size=9 weight=bold); run; title;