![]() However, in the previous table the difference in weeks was calculated as 2 since there were two partial weeks that fit between these two dates. In this table, the difference in weeks between Jan 1st and Jan 9th is calculated as 1 since only one whole week can fit between these dates. Notice the difference between this table and the previous table. Months_diff = intck(' months', start_date, end_date, ' c') Weeks_diff = intck(' weeks', start_date, end_date, ' c') Note that we can use the ‘ c‘ argument in the INTCK function to only calculate the difference in complete days, weeks, and months: /*create new dataset*/ĭays_diff = intck(' day', start_date, end_date, ' c') The three new variables show the difference between start_date and end_date in days, weeks, and months. Months_diff = intck(' months', start_date, end_date) Weeks_diff = intck(' weeks', start_date, end_date) Sas date calculator code#We can use the following code to calculate the difference between the values in the start_date and end_date variables in days, weeks, and months: /*create new dataset*/ĭays_diff = intck(' day', start_date, end_date) Suppose we have the following dataset in SAS that contains two date variables: /*create dataset*/ Example : Calculate Difference Between Dates in SAS Sas date calculator how to#The following example shows how to use this function in practice.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |