From the course: SAS® 9.4 Cert Prep: Part 10 Manipulating Data with Functions
Unlock this course with a free trial
Join today to access over 22,700 courses taught by industry experts.
Calculating date intervals - SAS Tutorial
From the course: SAS® 9.4 Cert Prep: Part 10 Manipulating Data with Functions
Calculating date intervals
- [Instructor] Suppose you need to count the number of some time interval, such as weeks, weekdays or months that have occurred between a start and end date. You can use the INTCK function to return the number of interval boundaries of a given time period that occur between two dates. The syntax for the INTCK function begins with the time interval you want to count. Examples of intervals are year, month, week or weekday. The second argument is the start date, and the third argument is the end date. The optional fourth argument defines the calculation method. Let's look at the start and end date for a storm in 2017 that began on the 21st of July, and ended on the 31st of July. Let's consider these dates on a calendar. How many weeks passed between these two dates? It depends on when one week ends and the next week begins. One option is to count the number of standard interval boundaries that occur between the dates. A…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
(Locked)
Useful numeric functions1m 5s
-
Demo: Using numeric functions2m 57s
-
(Locked)
SAS Date, Datetime, and Time Values53s
-
(Locked)
Extracting data from a Datetime value30s
-
(Locked)
Calculating date intervals2m 1s
-
(Locked)
Shifting date values50s
-
(Locked)
Demo: Shifting date values based on an interval3m 14s
-
(Locked)
-
-