intck. seconds = datetime2 - datetime1 ; mintues = (datetime2 - datetime1)/60 ; You can also use the. intck

 
 seconds = datetime2 - datetime1 ; mintues = (datetime2 - datetime1)/60 ; You can also use theintck  SELECT order_id, required_date, shipped_date, CASE WHEN DATEDIFF (day, required_date, shipped_date) < 0 THEN 'Late' ELSE 'OnTime'

(INTCK returns a negative value whenever the first date is later than the second date and the two dates are not in the same discrete interval. Month between two dates. The WHERE statement applies to all data sets in the preceding SET, MERGE, MODIFY, or UPDATE statement, and variables that are used in the WHERE statement must appear in all of those data sets. The example also shows how to create a DateTime variable where the date argument is a constant that SAS interprets as a Date. Results. Here's my code: DATA newdata; SET olddata; newvariable = INTNX ('month',olddate,0,"B"); RUN; The log says: Argument 2 to function INTNX is invalid. ; array holidays(6); do date. Assume I have 2 timestamp. It does not count the number of complete intervals between two dates: The following example returns 0, because the two dates are within the same month. (also didn't bother to test if the INTCK date variables need to be at the 1st of the month to give the correct results) data have; length date_1 $18 date_2 $8; infile. I had already tried INTCK. ; format TS datetime20. I ran a datastep with INTCK to create the var Minutes (between Start and End). For more information about working with date and time intervals, see Date and Time Intervals. ); e. I want to calculate the month between 01FEB2021 and 31JAN2022, but even with the continous option the result is 11 month. The INTNX () function knows about the MONTH interval but it knows nothing about an interval named 'MONTH'. No other values for basis are valid when computing a person’s age. Sep 22, 2015 at 17:21. For example, WEEK intervals are counted by Sundays rather than seven-day multiples from the from argument. Partial intervals are not counted. (Note: this article originally appeared on sasCommunity. Since DATE values are stored in days you can use subtraction to calculate differences in days. The function INTCK ('MONTH','31jan1991'd,'1feb1991’d) returns 1, because the two dates lie in different months that are one month apart. , hours is directly proportional to seconds (*3600) but intck ('HOUR. Data Migration. 6 days left in december, and 15 days in january the following year, add up to 21 days. . If the values are true SAS datetime values, then the duration is simply the subtraction of the End minus Start times. ; inpu. Looks like your time stamp values are numeric variables with datetime values. com. One of which best ways to understand the INTNX and INTCK functions and how they job is up see some easy examples. Now we set up a custom interval which we'll simply call "workdays". INTCK ( interval, from, to ); The arguments of the INTCK function are as follows: interval. The INTCK function counts the number of interval boundaries between two date values or between two datetime values. (INTCK returns a negative value whenever the first date is. . However, the sas functions such as INPUT, PUT, INTCK etc do not work inside the CONNECT TO TERADATA sql query. For instance Clent A has first_date_deposit as 15/07/2003 and last_date_deposit as 24/02/2010. 3. 1. Dec 21, 2022 at 21:49. The variable current3 is assigned the 95th day of the 2008 year using the datejul( ) function. ) function. How can I get the difference of the month, which is 1. For example, WEEK intervals are determined by the number of Sundays that begin between the from and the to, not by how many seven-day periods fall in between the from. Digital Transformation. 25 methods, age is computed both as a decimal and an integer value. According to the documentation it isn't rounding at all but, rather, simply counting the number of boundaries. options intervalds= (BankingDays=BankDayDS); data BankDayDS (keep=BEGIN); start = '15DEC1998'D;WEEKDAY<daysW> in INTCK Function: The INTCK function in SAS returns the number of interval boundaries that lie between two SAS dates, times, or timestamp values. CODE ,MUC. The form of the INTCK function is . INTCK ( interval, from, to ) ; The arguments of the INTCK function are as follows: interval. Here are some real-world examples of how the INTCK function is used in SAS. Would you be able to answer why this happen if you know of. the database): permno (identifier of the company), date, ret (return) shrout (shares outstanding), prc (price), ME (=shrout*prc), exchcd (exchange code, not shown. ; * use 12. Learn how to use INTCK Function in SAS with examples. . . If the value of basis is AGE, then YRDIF computes the age. For example, WEEK intervals are determined by the number ofThe INTNX (and its sister function for computing date differences, INTCK) are powerful tools for manipulating date and datetime values. Posted 06-19-2016 02:35 PM (12054 views) Hi , I need to calculate age at graduation. ); start date: The start date; end date: The end date; method: Whether to count. The form of the INTCK function is. Thanks,INTCK() DOES care whether the data variable is is seconds, etc. INTCK is the function to return intervals between date, datetime or time values. This function uses the following basic syntax: INTCK(interval, start date, end data, method) where: interval: Interval to calculate (day, week, month, year, etc. 24574: Calculate the number of years, months, and days between two dates. The month interval is specified in this implementation: INTCK('month',dob,eventdate) . There is no interval named DAYS. nmonths=intck('month',date1-1,date2-1); Just subtract 1 day less than the month starting day from both dates. I'm not sure how to make my own intervals. ) If you prefer to learn by watching (while listening. INTNX () is basically used to get the future or back dated date with a gap of given specific intervals like MONTH, WEEK, YEAR etc. The SAS INTCK Function: Examples. The sample code on the Full Code tab illustrates how to determine a person's current age using their date of birth. The following SAS program creates a temporary SAS data set called createdates that contains six date variables. Since we are discussing the WEEKDAY function already, let’s look at. DATETIME values are seconds. Can you please help suggesting what I'm doing wrong? The output dataset is blank because intck function isn't working properly. 1. So if you want to calculate minuates by yourself you need to divide by 60. This functioning uses the following basic syntax: INTCK(interval, start dating, end data, method) where: interval: Interval the calculate (day, week, hour, quarter, year, etc. The form of the function is as follows: INTCK(‘<measured duration>’ , <DATEA>, <DATEB>); For example, if you wanted to measure the days that occurred between variable DATEA and DATEB, the. Because start_dt - 1 will fall in previous month and will add '1' to the result of intck. Any clue? Thanks! data b; WeddingDay='14FEB2000'd; Today='28MAR2000'd; daysMarried=INTCK ('day',WeddingDay,today ()); format WeddingDay Today date9. I'm using SAS with SQL procedures. SAS Certification Part 12 INTCK & INTNX FunctionManage DataPerform calculations with date and datetime values and time intervals by using the functions INTC. if end is charecter then do as following. You can see the output in the attached pic. dischdate :yymmdd10. Re: How to extract a timestamp with one hour interval. ; sasdate=to_double(date'2011-03-15'); x=intnx('week', sasdate, 1, 'same'); put x; / returns 22MAR2011 returns 22MAR11. SAS stores datatime values in seconds. functions as F import datetimeTo successfully process ANSI values in DS2 using SAS interval functions, such as INTCK or INTNX, you must first explicitly convert them to the appropriate SAS double-precision numeric value. SAS INTNX ( ) function is one of the important date functions in SAS. Eles pegam as variáveis de dados como argumentos e retornam o resultado que é armazenado em outra variável. The function INTCK ('MONTH','1feb1991'd,'31jan1991'd) returns –1 because the first date is in a later discrete interval than the second date. Closed 11 years ago. Improve this answer. . date1 = day (date): Returns the day of month from the variable date. SAS® 9. FORMAT MY_DATETIME: DATETIME20. ちなみに同じ結果を返す他の計算式として、以下2つ. 1. lastDaylastMonth=day (intnx ('month', current_date, -1, 'E')); INTNX Function in SAS to Calculate The Last Day of The Last Month. Appointment Expiration date isn't a date as you convert it earlier 0 LikesRe: intck function will not get my desired result. If your teradata table is very large just for test get only few rows (Obs=10). – Cliff AB. Solved: log_date cst_id 09Dec2016 101 20Jan2016 102 16Jul2015 103 The format of column "log_date" is DATE9. cchex=put (cc,hex4. I could program this out, but I am guessing there is probably a format or function I'm not aware of to accomplish the task. Data Science. . The portion begins with the character that you specify by position. Use the SAS DAY() function here. Converting SAS PROC SQL to SQLITE queries in python - SAS intck function. Or target location of 'B'. In addition the date values can also be aligned to start, mid or end of given interval. . Total_days = intck ('dtday',begin_date,end_date); may be what you are looking for. Syntax INTCK in SAS: INTCK (‘Interval’, start_date, end_date) Interval – can be in minutes, seconds, hours,weeks, days, months,quarter and year. W3Schools offers free online tutorials, references and exercises in all the major languages of the web. First point - most other systems I've used use a base-dating system, whether it be 1Jan1960, 1Jan1901 or similar, and allow day arithmetic. The. Remove the extra run; statement that is ending the data step definition too soon. ); put cc hex4. So just take the difference and apply the TIME format to have the number of seconds print in the tradition HH:MM:SS style. In the INTCK function there is an option to set “interval”. 05 -2 28. この関数は次の基本構文を使用します。 INTCK (間隔、開始日、終了データ、メソッド) 金: 間隔: 計算する間隔 (日、週、月、四半期、年など); 開始日: 開始日; 終了日: 終了日; method: 離散または連続方法を使用して. I have both these variables, but I am unable to figure out a proper syntax to get the de. Dictionary of Component Object Language Elements. . BAN) >1 THEN. 01jan60. By using multipliers and shift indexes, you can create multiples of intervals and shift their starting point to construct more complex interval specifications. Make your decision as to what you need to do! Also, here are some additional resources that may be helpful if you want to truly understand what is going on underneath the hood. ) You can use the INTCK function in SAS to quickly calculate the difference between two dates in SAS. If you use "C", then the DTHOUR boundary is not the normal boundary (i. You could ask for "dtmonth" to get the months between or "dtyear". I'm trying to recreate a SURV_MM variable in the gold-standard dataset. from. 1. Viewed 100 times 1 I have this dataset and need to calculate the days' difference between each dose date per period. Thus, in this products you will find some. For more information on this INTCK and INTNX acts, perceive INTCK real INTNX: Two essential functions for computing intervals between dates in SAS, an items by @Rick_SAS. The intck function can return a negative value if the second value is less than the first. The increment is based on a starting date, time, or datetime value, and on the number of time intervals that you specify. With DAY () function in SAS further you can extract day from that date. Difference Between two dates using INTCK function in SAS: difference between two dates in days, weeks, months & year in SAS. The INTNX function returns the SAS date value for the. if difference between two dates are 1. Re: INTCK to compute minutes between dates. “day” or “month”. If you use two-digit year numbers for dates, you probably need to adjust the default setting for the YEARCUTOFF= option to work with date ranges for your data, or switch to four-digit years. sas. Artificial Intelligence. SUBSTR extracts a portion of the value by stating. Couldn't figure out why the intck function return wrong days. I need to find the difference between two dates in Pyspark - but mimicking the behavior of SAS intck function. SAS : INTCK Function with Examples - Example 11: Loop through Dates Using a Macro. 以下のデータセットがあったとします。. And it's pretty darned close. For the period unit, you can choose years, months, weekly, life, and more. I am having hard time getting the INTCK function to return the result i am using the following query. Method 2: Round to Specific Decimal Places. That is a very confusing way to write a data step. (start_dt) Parameter 3 is the end date. The INTCK function works both with time variables and datetime variables. The days are numbered as Sunday(1) . 25 methods, age is computed both as a decimal and an integer value. Difference between two dates in year is accomplished using INTCK function with ‘year’ as argument as shown below. With the %LET statement, you can create a macro variable named &start_dt and &stop_dt. SAS INTNX() is the function that needs parameters like Interval, start_date, and a number of intervals to be added for a specified date value. , date and time intervals that don't have a direct proportional relationship to the base date or time units (days and seconds, respectively). You can use the INTCK function in SAS to quickly calculate the difference between two dates in SAS. data temp; x = '12345'; new_x = input (x,5. Question eg: INTCK('QTR',FIN_YR,CNT_DATE)+5 What would provide me with the same answer in a SQL-Netzza code. POLICY_EFCTV_DT. ». . So putting macro code, ,especially macro definitions, in the middle of a data step is just going to confuse the humans trying to read the code. Parameter 1 is the interval. Re: INTCK Function and Rounding. mnthnum1=intck ( 'month', '25aug2000'd, '05sep2000'd); mnthnum1=1. You cannot use the WHERE statement with the POINT= option in the SET and MODIFY statements. The function INTCK ('MONTH','31jan1991'd,'1feb1991’d) returns 1, because the two dates lie in different months that are one month apart. The default is “DISCRETE” but you can specify if you want to use the “CONTINUOUS” method. For example, in my previous article I used the INTCK function to ascertain the number to epoch between two dates. input fname :$12. In this case, my preferred solution would involve using an R version of SAS' INTCK function to do dates arithmetic in a more sophisticated way than described in my original example. Note: The INTCK function returns the integer number of time intervals in a given time span. The form of the INTCK function is: INTCK ( interval, from, to ) ; The arguments of the INTCK function are as follows: interval is a character constant or variable that contains an interval name. You can create multiples of the intervals and shift their starting point. ex. 1 day, 2 hours, 30 minutes) In this case, if I used INTCK I would need to keep the units in either days or hours, but I can't get. in this case i need data from Jan 2019 to jun 2019, that is 6 months before run date specified above. cust_field_nm eq "x_case_dte_dd" and datepart (tbl. DATA dataset; set dataset; months_exact = intck ('months'. SELECT order_id, required_date, shipped_date, CASE WHEN DATEDIFF (day, required_date, shipped_date) < 0 THEN 'Late' ELSE 'OnTime'. intnx関数について基本の話. SAS software treats the year 2000 like any other leap year. Thus the "weekdays" involved in the calculation of days1 are 1-2-3/4/5, where / indicates the counted boundaries. The time unit can be selected in years, months, weeks, days, or whatever you feel like. For one thing, I still haven't quite figured out how to use R functions within a sqldf query, the same way I could use one of many SAS functions within PROC SQL. The INTCK function calculates the difference between two dates or times, whereas the INTNX function adds days or times to a date. Or create a second data step to read the data back in and run your age calculations. exclude public holidays and weekends. . The INTCK function counts intervals from fixed interval beginnings, not in multiples of an interval unit from the from value. (INTCK returns a negative value whenever the first date is later than the second date and the two dates are not in the same discrete interval. I am still not sure I understand what your looking to produce in the query. INTCK - INT= Interval CK= Check. 21_M3. Explanation. Your then filtering based on anndats, only selecting records where b anndats value is less than a anndats or b. The difference between these two dates is 10 days but just because the month has changed from March to April, the INTCK function (with discrete method) considers the difference between them to be 1 month. I'm trying to flag 30 days of data in my SAS code. If only one value is listed, then the COALESCE function returns the value of that argument. There is an enormous difference between days since 1/1/60, and seconds since midnight, 1/1/60. Data Mylib. PG. 677. Please advise. sas. ); start set: The initiate date; out target: The stop date; method: Count. ” Ron’s book reminds us that the “INTCK function counts how many times you cross a boundary going from the start date to the end date. You need to apply a format to the date value so it displays properly. You can use the INTCK function in SAS to quickly calculate the difference between two dates in SAS. For example, you can use the INTNX function till compute the date that remains 308 epoch in that future from a. Series #. SAS provides date, time, and datetime intervals for counting different periods of elapsed time. PROC SQL; CREATE TABLE historical AS. This page lists all possible intervals. It's been a while working. If "to" is before "from", the function returns a negative value. 5 years it will round off to 2 years. intck () requires three arguments: an interval designator, and two SAS dates if a date interval is specified. ERROR: Function INTCK requires a numeric expression as argument 2. Thank you. You need to specify dates, not datetimes. . Renaming date variable to perform an intck to calculate day difference. The INDEX function searches source, from left to right, for the first occurrence of the string specified in excerpt, and returns the position in source of the string's first character. This function uses the following basic syntax: INTCK(interval, start date, end data, method) where: interval: Interval to calculate (day, week, month, quarter, year, etc. More specifically, it cares whether the value is a datetime value or a date value. ) returns the month from a SAS date value (. com. 1 About SAS Enterprise. dev. INTCK function returns the integer count of the number of interval boundaries between two dates, two times, or two datetime values. I am using the intck function to calculate it with the 4th arguement (method = 'C') but I think the 4th argument just works in case of years. 25. I am facing issues with calculation of the time diffference for time expressed in hhmm, the data is representwed in decimals and would like to see the data represented in time format. . Every single function in a %LET needs to be wrapped, including your INTCK () and MDY (). The INTNX function returning ampere SAS date that is a specifications number of time units away from a specified date. SAS INTCK ( ) function is one of the important date functions in SAS. However, the numbers remain the same and as you can see, I'm still getting date values in the activity_date field that are more than 14 days after the send date (2/1). The Basics; DBCS Compatibility; The Basics. This will work for months declared to begin on the 1st through 28th. is a character constant or variable that contains an interval name . Data set example: Subject_ID Date Obs 10 01/02/21 1 10 01/. The INTCK function returns the integer count of the number of intervals in years, months or days between two dates. Example of Continuous INTCK Function: 10 %put %sysfunc(intck('month',1,2)); WARNING: An argument to the function INTCK referenced by the %SYSFUNC or %QSYSFUNC macro function is out of range. 2 Language. Divide 21 by 31 days will give you . The intck function can return a negative value if the second value is less than the first. (month) Parameter 2 is the start date. For example, INTCYCLE('MONTH') returns 'YEAR' since the months January. The INTNX function returns the SAS date value for the beginning date, time, or datetime value of the interval that you specify in the start-from argument. 47 months. Metadata. Tutorial : INTCK Function Explained 44. end date: Ending SAS date. A Series is the data structure that. data new_data; set original_data; new_value = round (value); run; . It does not count the number of complete intervals between two dates: Moving and Accessing SAS Files. For example, 0. For example, you can use the INTNX functions to compute the scheduled that is 308 total in of future from. 24567: Calculate a person's age. Anniv = intnx ('year', '30APR1789'd, 7, 'same'); returns the 7th anniversary of the date 30APR1789. documentation. If the second date is later than the first date then 0 is returned. The INTCK function counts the number of interval boundaries between two date values or between two datetime values. For help clarifying this question so that it can be reopened, visit the help center . You can define a method to calculate differences. 4 Functions and CALL Routines: Reference, Fifth Edition documentation. 1); /*round to 1 decimal place*/ new_value2 = round (value,. In this case you would need to adjust the argument ('QTR') in intck ('qtr',begdate,enddate). What this means is that INTNX checks for intervals whereas INTCK is useful for computing a date/datetime value on the basis of a different date/datetime value. To compute age using a date of birth and the current date, use the following code: DATA birth; INPUT id birthday MMDDYY6. COALESCE accepts one or more numeric arguments. 関数INTCK('MONTH', '1feb2021'd, '31jan2021'd)では、1番目の日付が2番目の日付よりも1つ後の別の間隔内に存在するため、-1を返します。(1番目の日付が2番目の日付よりも後で、2つの日付が同じ間隔内に存在しない場合、INTCKは常に負の値を返します)。 Posted 08-31-2017 12:11 AM (7829 views) | In reply to EEEY. difference=datetime1-datetime2; format difference time8. The first method "CONNECT TO TERADATA" is more efficient than the second method - LIBNAME statement as the first method hits the tables in teradata server and it would take less execution time. For the INTCK method, age is computed only as an integer. 03 -5 15 0. I. SAS 区间函数 INTNX 和 INTCK. Given that the original question represented dates, using the HOURS interval with date values. A DataFrame in pandas is analogous to a SAS data set - a two-dimensional data source with labeled columns that can be of different types. If all the values of all arguments are missing, then the COALESCE. . It easy to play with the dates using INTNX. 3. DATA Step Programming. If you want to know how to add days, weeks, months, etc. current_year = year (date ());NOTE: Invalid argument to function DATDIF(19996,19774,'30/act') at line 92 column 19. data new; set test; nmonths=intck('month',assign_date,completed_date); run; proc print data=new; var assign_date completed_date nmonths; run;Re: calculating calendar days and work days with intck. Datetimes are the number of seconds from January 1, 1960, Date variables are the number of days from January 1, 1960 and Times are just seconds. ERROR: Unresolved reference to table/correlation name s_cases. And this is the logic: Work start time: 9am. The variables. value_dt) < today ();. Glad to be able to help 🙂 When calling DATA step function from MACRO using %SYSFUNC, the general rule is to always leave out the quotes. data new_data; set original_data; new_value1 = round (value, . (end_dt) Parameter 4 is the method. . If the string is not found in source, INDEX returns a value of 0. ; datalines; 188 18Jul17:15:27:00 97 188. 000 diff2=2,962. For the YRDIF and 365. The subjects each have a start and end date that is different. Apart from this difference, there is a minor difference in the syntax. Re: Date difference using SAS INTCK. 3 in decimal arithmetic. INTNX shifts a date by a specified interval, while INTCK computes the intervals between two dates. SAS is headed back to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. No necessarily, if the start date lets say 2nd of the month, then it would only move the date back to 1st of the month. . How is SAS supposed to know if should be a text value of 'INTNX' or if you want to use it as a function? To differentiate, everything is interpreted as text unless you specify otherwise. The INTCK function using the default discrete method counts the number of times the beginning of an interval is reached in moving from the first date to the second. In those cases, the floor function may be removed to obtain the following formula:In general, ROUND (argument, rounding-unit) produces the result that you expect from decimal arithmetic if the result has no more than nine significant digits and any of the following conditions are true: The rounding unit is an integer. They are tricky to learn at first, but once you get the hang of them they can really. g. “The INTCK function counts the number of intervals between the two dates and returns a number. By example, in my previous article I utilised the INTCK function to determine the number of. 000 diff1=2,962. Note: This is Example 6. . INTCK is not needed. The INTCK function using the default discrete method counts the number of times the beginning of an interval is reached in moving from the first date to the second. 1. . In either case if the value in the STARTDATE variable is AFTER the value in the ENDDATE variable then the difference will be a negative number. ①結果自体は、SASテクニカルサポート「年齢の計算方法」にあるやつと同じになる。. Difference between INTNX and INTCK functions. So that we can call and refer to the INTCK as INTerval ChecK, everyone knows the INTCK function, which helps to return the integer count of the. "as is" without warranty of any kind, either express. ERROR: Expression using less than (<) has components that are of different data types. 結果データセット「AGE2」. options intervalds= (BankingDays=BankDayDS); data BankDayDS (keep=begin); start = '15DEC1998'd; stop = '15JAN2002'd; nwkdays = intck ('weekday',start,stop); do i = 0 to nwkdays; begin = intnx. if start is charecter then do as following. Example. Datetime, time or date variables are just numeric values, with a format to show them as dates. January 2, 2017 to January 30, 2017 ==> INTCK returns 0, since there are no "1st of the month" dates within the interval. In SAS 9. The INTNX () function is used to loop through dates based on an offset. The INTCK() function can also count backwards: when end-of-period is a date prior to start-of-period, the INTCK() function will return a negative number. INTCK – The INTCK in SAS is a function that returns the number of time units between two dates. format. Whether you're a beginner or an advanced user, this tutorial offers a hands-on approach. Thanks a lot for your reaction! What I try to accomplish is the following: I have a dataset that has monthly observations for the following variables from CRSP (i. デフォルトのDISCRETEメソッドを使用するINTCK関数は、1番目の日付と2番目の日付の間に次の間隔の開始点が含まれる回数を数えます。. . df["diff"] = np. They are 'DISCRETE' (the default) and 'CONTINUOUS' (or "D" and "C"). These sample files and code examples are provided by SAS Institute Inc. If you want to present this number of seconds as HH:MM:SS, you could use the proper format, which is the TIMEw. The SAS date function INTCK with syntax INTCK(interval,from,to) returns the number of interval boundaries that are crossed between the two dates provided. DATA y; SET test; Minutes = INTCK('minute',start,end); PROC PRINT DATA=y; VAR Start End Minutes; WHERE mapinfoid<4; RUN; Obs Start End FTMinutes 1 31DEC01:22:00 01JAN02:02:00 240. (end_dt) Parameter 4 is the method. 2. It is worth to note that INTCK gives the time intervals passed between two dates as per the calendar. SAS provides date, time, and datetime intervals for counting different periods of elapsed time. ); start date: The start date; end scheduled: The end enter; method:. )); put _all_; datalines; 07:00. calendar_days =intck (' dt day', date2, date1); calendar_days1 =intck ('day', date2, date1); week_days=intck. ); 2. g. I am working on converting some SAS Proc SQL’s into SQLite queries to be used in a python program, and unfortunately it is not a direct copy and paste and there are some issues. And if you compare dates to datetimes directly you very seldom get the correct result. Find resources and documentation for new and previous releases of SAS technology. One thing that the INTCK() function will not do is return a non-integer value, because there is no such thing as a partial interval boundary. It will result in different output if the start_dt is the first of the month. Hence if the difference between Feb 1st and Mar 1st is 29, then the event occurred on a leap year, and imputes the missing day as 29th, otherwise, impute with 28th. The INTCK function returns the number of time units between dates. So for "31MAY13:00:00:00", it will give me "01MAY13:00:00:00". The time unit can be selected in years, months, weeks, days, or whatever you feel like.