Help using Base SAS procedures

Axis labels in proc sgplot

Accepted Solution Solved
Reply
Frequent Contributor
Posts: 138
Accepted Solution

Axis labels in proc sgplot

Hi all,

I am trying to create two kernel density curves comparing month counts between men and women. Basically I've created two month count variables (monthmale and monthfemale) such that the former only populates for male subjects and the latter for female subjects. I used the following code:

proc sgplot data=monthcount;

xaxis label="Months" min=0 max=24;

yaxis label="Relative Probability of Occurrence";

density monthmale /type=kernel ;

density monthfemale/type=kernel ;

run;

The curves generate with no problem. The issue is that the maximum number of months a person can have is 24, so I'd like the axis to go from 0-24. However, even with the option I used above for xaxis, the axis goes from 0 to 25.

Any help is much appreciated.

Thanks!


Accepted Solutions
Solution
‎04-21-2014 12:11 PM
Super User
Posts: 10,461

Re: Axis labels in proc sgplot

Does your axis show all values from 0 to 25 or just 0, 5, 10, 15, 20 and 25? If the later it is because the algorithm for fitting in the space you have available and rounding has picked 25 as an upper bound. You may need to provide more controls on the axis such as values= 0 to 24 by 1.

View solution in original post


All Replies
Solution
‎04-21-2014 12:11 PM
Super User
Posts: 10,461

Re: Axis labels in proc sgplot

Does your axis show all values from 0 to 25 or just 0, 5, 10, 15, 20 and 25? If the later it is because the algorithm for fitting in the space you have available and rounding has picked 25 as an upper bound. You may need to provide more controls on the axis such as values= 0 to 24 by 1.

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 1 reply
  • 142 views
  • 0 likes
  • 2 in conversation