BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Uche_Okoro
Fluorite | Level 6

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;

1 ACCEPTED SOLUTION

Accepted Solutions
SuzanneDorinski
Lapis Lazuli | Level 10

 

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;

Series plot of proportion with ulcer by proportion with pain by doseSeries plot of proportion with ulcer by proportion with pain by dose

View solution in original post

3 REPLIES 3
WarrenKuhfeld
Rhodochrosite | Level 12

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.

Uche_Okoro
Fluorite | Level 6
Thank you so much for your prompt response. I did as you suggested but I
still could not get the desired result.

The following are my data and variable.

data Ulcer;
input week dose Proportion_with_ulcer proportion_with_pain @@;
cards;
0 0 1 0.83
0 400 1 1
0 800 1 0.82
0 1600 1 0.85
1 0 0.81 0.79
1 400 0.82 0.80
1 800 0.84 0.70
1 1600 0.79 0.70
2 0 0.71 0.71
2 400 0.63 0.56
2 800 0.62 0.40
2 1600 0.51 0.35
4 0 0.59 0.60
4 400 0.38 0.50
4 800 0.28 0.38
4 1600 0.26 0.30
;
run;

I would appreciate it if you could write the SAS code.

Thank you.

Uche
SuzanneDorinski
Lapis Lazuli | Level 10

 

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;

Series plot of proportion with ulcer by proportion with pain by doseSeries plot of proportion with ulcer by proportion with pain by dose

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 814 views
  • 1 like
  • 3 in conversation