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

Hello,

I have time series data with 24 hours  observations per day for an entire year . I need to transform the data into daily average. How would that be done.

Thanks

 

01.png

1 ACCEPTED SOLUTION

Accepted Solutions
Tom
Super User Tom
Super User

Why not just use PROC MEANS (aka SUMMARY)?

proc summary data=have ;
  by date;
  var nt ;
  output out=want mean=nt_mean ;
run;

View solution in original post

5 REPLIES 5
mkeintz
PROC Star

By  "daily average", do you mean the average hourly measure for each day?

--------------------------
The hash OUTPUT method will overwrite a SAS data set, but not append. That can be costly. Consider voting for Add a HASH object method which would append a hash object to an existing SAS data set

Would enabling PROC SORT to simultaneously output multiple datasets be useful? Then vote for
Allow PROC SORT to output multiple datasets

--------------------------
Job04
Quartz | Level 8

Yes, I meant the daily hourly average, also it can be considered an overall average for the day.

Tom
Super User Tom
Super User

Why not just use PROC MEANS (aka SUMMARY)?

proc summary data=have ;
  by date;
  var nt ;
  output out=want mean=nt_mean ;
run;
Job04
Quartz | Level 8

Works well. Thanks

Job04
Quartz | Level 8
Just one thing to add, this code gives the daily averages only of the first month listed in the data, but I would like to get that for every single month in the data. So my data starts with March so I got averages only for March.

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 5 replies
  • 1130 views
  • 0 likes
  • 3 in conversation