cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
JMP is taking Discovery online, April 16 and 18. Register today and join us for interactive sessions featuring popular presentation topics, networking, and discussions with the experts.
Choose Language Hide Translation Bar
paulp
Level III

average by month

I have ratings data for different locations across 2009-2011.  The data formatted in two columns => rating | date   e.g. 0.85 | 06/29/2010.  How can I average the ratings by month?  thanks, Paul

2 REPLIES 2

average by month

Hi Paul,

There are many ways you could do this. You could create a variable that is by month and year and use SQL to do the aggregation or you could do this in a data step with by group processing (assuming you had your month & year variables) or you could simply use proc means.

Syntax will be something like...

proc means data=mydata mean; *if you want the default statistics then remove mean here otherwise it will give you the average ratings by month;

     var rating;

     class date;

     format date monyy7.; *This is to get the 12 month categories for each year;

run;

Doing the above avoids having to spend time creating new variables etc and you take advantage of the benefits of using a SAS format for group processing.

I hope this helps.

Cheers,

Michelle

MTOF
Level III

average by month

Hi Paul

Assuming your columns are called Rating and Date


You could add two columns Month and Year with the formulas month(Date) and year(Date) (they are both in the Date Time group) respectively.

Then do Tables/Summary, Statistics:Mean of Rating and Group:Year and Month.

BR, Marianne