- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi folks,
I am trying to plot the following data where 'quarter' should be X-axis and number of visits per group (control and intervention) on Y-axis but when I plot it using proc SGplot, it doesn't pick all quarters points, it only picks four quarters on x-axis and draws strange lines.
How do I fix that please?
Ta
data control1_plot; input Quarter $ Control intervention; datalines; Jan-Mar12 274 109 Apr-Jun12 769 148 Jul-Sep12 1242 276 Oct-Dec12 1015 226 Jan-Mar13 755 176 Apr-Jun13 800 134 Jul-Sep13 1078 270 Oct-Dec13 1283 207 Jan-Mar14 862 160 Apr-Jun14 1004 193 Jul-Sep14 1215 181 Oct-Dec14 1767 251 Jan-Mar15 1090 145 Apr-Jun15 1120 149 Jul-Sep15 1402 239 Oct-Dec15 1728 239 Jan-Mar16 1412 124 Apr-Jun16 1402 147 Jul-Sep16 1632 208 Oct-Dec16 1783 215 Jan-Mar17 1238 157 ; run;
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Please try with the entire code below
data control1_plot;
input Quarter :$10. Control intervention;
datalines;
Jan-Mar12 274 109
Apr-Jun12 769 148
Jul-Sep12 1242 276
Oct-Dec12 1015 226
Jan-Mar13 755 176
Apr-Jun13 800 134
Jul-Sep13 1078 270
Oct-Dec13 1283 207
Jan-Mar14 862 160
Apr-Jun14 1004 193
Jul-Sep14 1215 181
Oct-Dec14 1767 251
Jan-Mar15 1090 145
Apr-Jun15 1120 149
Jul-Sep15 1402 239
Oct-Dec15 1728 239
Jan-Mar16 1412 124
Apr-Jun16 1402 147
Jul-Sep16 1632 208
Oct-Dec16 1783 215
Jan-Mar17 1238 157
;
run;
PROC SGPLOT DATA = control1_plot;
series x=quarter y=control;
series x=quarter y=intervention;
RUN ;
Jag
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Is this what you are expecting, but the y axis can be only one per graph either control or intervention
here i used control, Please let me know how you need the graph if this is not the expected one
PROC SGPLOT DATA = control1_plot;
VBAR quarter / REsponse = control;
RUN ;
Jag
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I want something like the following but can't label quarters on X-axis as for example Jan-Mar12 instead of quarter 1;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Please try the below code
PROC SGPLOT DATA = control1_plot;
series x=quarter y=control;
series x=quarter y=intervention;
RUN ;
Jag
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I had but it's giving me something like this;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Please try with the entire code below
data control1_plot;
input Quarter :$10. Control intervention;
datalines;
Jan-Mar12 274 109
Apr-Jun12 769 148
Jul-Sep12 1242 276
Oct-Dec12 1015 226
Jan-Mar13 755 176
Apr-Jun13 800 134
Jul-Sep13 1078 270
Oct-Dec13 1283 207
Jan-Mar14 862 160
Apr-Jun14 1004 193
Jul-Sep14 1215 181
Oct-Dec14 1767 251
Jan-Mar15 1090 145
Apr-Jun15 1120 149
Jul-Sep15 1402 239
Oct-Dec15 1728 239
Jan-Mar16 1412 124
Apr-Jun16 1402 147
Jul-Sep16 1632 208
Oct-Dec16 1783 215
Jan-Mar17 1238 157
;
run;
PROC SGPLOT DATA = control1_plot;
series x=quarter y=control;
series x=quarter y=intervention;
RUN ;
Jag