I am trying to reproduce this graph but to make proportion with pain the y axis and those with ulcer the x axis.
I have tried
proc sgplot data=ulcer;
series x=Proportion_with_ulcer y=proportion_with_pain / group=dose break /**lineattrs=(pattern1= solid pattern2=dot pattern3=dashdashdot pattern4=shortdash color=black )"**/;
pattern1 value= dose color=blue;
pattern2 value=dose color=red;
pattern3 value=dose color=pink;
pattern4 value=dose color=green;
xaxis label='Proportion of Patients with Duodenal Ulcers' values=(0 to 1 by 0.2);
yaxis grid label='Proportion of Patients with Daytime UGI Pain' values=(0 to 1 by 0.2);
portion of Patients with Daytime UGI Pain' values=(0 to 1 by 0.2);
run;
it is not giving me what I want.
Please I need help urgently.
Thank you
quit;
proc format;
value dose
0 =' 0 mg hs'
400 =' 400 mg hs'
800 =' 800 mg hs'
1600 ='1600 mg hs'
;
run;
proc sgplot data=ulcer;
series x=proportion_with_pain y=proportion_with_ulcer / group=dose datalabel=week datalabelattrs=(size=10 weight=bold);
styleattrs datalinepatterns=(solid shortdash mediumdash longdash);
refline 0 0.2 0.4 0.6 0.8 1 / axis=y;
xaxis min=0 label='Proportion of patients with Duodenal Ulcers';
yaxis min=0 label='Proportion of Patients with Daytime UGI pain';
format dose dose. ;
keylegend / title='' down=2;
inset '1, 2, 4 weeks of follow-up' / textattrs=(size=12 weight=bold) position=right;
run;
You should look at the documentation for sgplot. Also search for "basic ods graphics examples" book. Pattern statements are sas/graph and are ignored in ods graphics.
proc format;
value dose
0 =' 0 mg hs'
400 =' 400 mg hs'
800 =' 800 mg hs'
1600 ='1600 mg hs'
;
run;
proc sgplot data=ulcer;
series x=proportion_with_pain y=proportion_with_ulcer / group=dose datalabel=week datalabelattrs=(size=10 weight=bold);
styleattrs datalinepatterns=(solid shortdash mediumdash longdash);
refline 0 0.2 0.4 0.6 0.8 1 / axis=y;
xaxis min=0 label='Proportion of patients with Duodenal Ulcers';
yaxis min=0 label='Proportion of Patients with Daytime UGI pain';
format dose dose. ;
keylegend / title='' down=2;
inset '1, 2, 4 weeks of follow-up' / textattrs=(size=12 weight=bold) position=right;
run;
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.