Hi folks,
I am using proc sgplot to plot two time-series trends and I want to get rid of axis labels because it displays whatever name I have for 'y=......' for the first time-series as y-axis label.
Can someone shed some light on this please?
thanks
S
Like this?
data control2;
input Quarter $ 1-9 Comparator Intervention;
datalines
;
Jan-Mar12 0.10 0.22
Apr-Jun12 0.10 0.21
Jul-Sep12 0.15 0.42
Oct-Dec12 0.10 0.34
Jan-Mar13 0.05 0.29
Apr-Jun13 0.07 0.17
Jul-Sep13 0.10 0.36
Oct-Dec13 0.12 0.31
Jan-Mar14 0.09 0.22
Apr-Jun14 0.12 0.23
Jul-Sep14 0.11 0.24
Oct-Dec14 0.15 0.34
Jan-Mar15 0.10 0.21
Apr-Jun15 0.12 0.18
Jul-Sep15 0.10 0.33
Oct-Dec15 0.10 0.33
Jan-Mar16 0.08 0.16
Apr-Jun16 0.10 0.18
Jul-Sep16 0.11 0.28
Oct-Dec16 0.14 0.30
;
run;
* doing plots of the data by quarter;
PROC SGPLOT DATA = control2;
SERIES X = Quarter Y = Comparator;
series x=Quarter y=Intervention;
TITLE 'Quarterly time-series of perentage of asthma visits in under 2 and 2-16 year olds, Bradford';
yaxis label='Percentage';
RUN;
Can you show us your code please?
Here you go. In this example, the first series I have has y=comparator so it will pick 'comparator' as y-axis label. while I want to label the y-axis as 'percentage'.
*Plotting quarterly asthma visits by age (comparing under 2 with 2-16 years) in Bradford only;
data control2;
input Quarter :$10. Comparator Intervention;
datalines
;
Jan-Mar12 0.10 0.22
Apr-Jun12 0.10 0.21
Jul-Sep12 0.15 0.42
Oct-Dec12 0.10 0.34
Jan-Mar13 0.05 0.29
Apr-Jun13 0.07 0.17
Jul-Sep13 0.10 0.36
Oct-Dec13 0.12 0.31
Jan-Mar14 0.09 0.22
Apr-Jun14 0.12 0.23
Jul-Sep14 0.11 0.24
Oct-Dec14 0.15 0.34
Jan-Mar15 0.10 0.21
Apr-Jun15 0.12 0.18
Jul-Sep15 0.10 0.33
Oct-Dec15 0.10 0.33
Jan-Mar16 0.08 0.16
Apr-Jun16 0.10 0.18
Jul-Sep16 0.11 0.28
Oct-Dec16 0.14 0.30
;
run;
* doing plots of the data by quarter;
PROC SGPLOT DATA = control2;
SERIES X = Quarter Y = Comparator;
series x=Quarter y=Intervention;
TITLE 'Quarterly time-series of perentage of asthma visits in under 2 and 2-16 year olds, Bradford';
RUN;
Like this?
data control2;
input Quarter $ 1-9 Comparator Intervention;
datalines
;
Jan-Mar12 0.10 0.22
Apr-Jun12 0.10 0.21
Jul-Sep12 0.15 0.42
Oct-Dec12 0.10 0.34
Jan-Mar13 0.05 0.29
Apr-Jun13 0.07 0.17
Jul-Sep13 0.10 0.36
Oct-Dec13 0.12 0.31
Jan-Mar14 0.09 0.22
Apr-Jun14 0.12 0.23
Jul-Sep14 0.11 0.24
Oct-Dec14 0.15 0.34
Jan-Mar15 0.10 0.21
Apr-Jun15 0.12 0.18
Jul-Sep15 0.10 0.33
Oct-Dec15 0.10 0.33
Jan-Mar16 0.08 0.16
Apr-Jun16 0.10 0.18
Jul-Sep16 0.11 0.28
Oct-Dec16 0.14 0.30
;
run;
* doing plots of the data by quarter;
PROC SGPLOT DATA = control2;
SERIES X = Quarter Y = Comparator;
series x=Quarter y=Intervention;
TITLE 'Quarterly time-series of perentage of asthma visits in under 2 and 2-16 year olds, Bradford';
yaxis label='Percentage';
RUN;
Ta.
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.