BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Annie_Fréchette
Obsidian | Level 7

Hi, I'm a new user of SAS and my question may be basic. I want to calculate a duration. I want to substract my first date of sampling from my last date of sampling. And I want to know how many days have passed between these two dates. My dates are numeric values. Here is what I've tried so far....Thanks you very much for your help!!

SAS1.PNG

1 ACCEPTED SOLUTION

Accepted Solutions
PaigeMiller
Diamond | Level 26
duration = Datemax - Datemin;

 

gives you the duration in seconds.


To get the number of days, you divide by ... well, you can figure out that, I'm sure.

--
Paige Miller

View solution in original post

4 REPLIES 4
PaigeMiller
Diamond | Level 26
duration = Datemax - Datemin;

 

gives you the duration in seconds.


To get the number of days, you divide by ... well, you can figure out that, I'm sure.

--
Paige Miller
Annie_Fréchette
Obsidian | Level 7

Thank you!!!

ed_sas_member
Meteorite | Level 14

Hi @Annie_Fréchette 

 

In addition to @PaigeMiller 's comment, there is no need to use the input() function as your dates are already numeric.

Annie_Fréchette
Obsidian | Level 7
THank's or the info!

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 4 replies
  • 561 views
  • 0 likes
  • 3 in conversation