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.

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 5 replies
  • 1871 views
  • 0 likes
  • 3 in conversation