BookmarkSubscribeRSS Feed
brooksj029
Fluorite | Level 6

Dear SAS Community,

 

I'm looking for advice on the simplest way to summarize a dataset. I have data from a number of temperature loggers which recorded the temperature at 10-minute intervals throughout the day. I want to find the mean nightly temperature for each night at each site. My dataset has three variables: var1=site ID, var2=date and time of temperature reading, var3=temperature. It seems like this would be pretty straight forward using a where statement in proc summary. The problem is sunrise and sunset changed almost every night. Does anyone have suggestions?  

2 REPLIES 2
PaigeMiller
Diamond | Level 26

Before you use PROC SUMMARY, in the actual dataset, assign a value of "DAY" or "NIGHT" (or whatever words you choose) to each observation, based on the time of the observation and the sunrise and sunset for that day.

 

Then use PROC SUMMARY on only those observations where the variable has the value "NIGHT".

--
Paige Miller
ballardw
Super User

Is "night" defined as the same time of day every day or does it change by season, i.e. daylight vs non-daylight hours?

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

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