Hello team,
I have two fields with date data types: their format is yyyy-mm-dd. I used intck function as monthdidd(month, startdate, finaldate). Some of the rows doesn’t show correct result . For example, it should show 10 months, it shows 1440. What is causing this?
appreciate your response.
blue in the sky
Check the values of your date variables.
1,440 months is 120 years.
1954 data test; 1955 today=date(); 1956 future=intnx('month',today,1440); 1957 format today future yymmdd10.; 1958 put today= / future= ; 1959 run; today=2022-11-08 future=2142-11-01
Hello Tom,
The problem is that my intck doesn't bring the correct result. I can eyeball it and see the interval is 11 months, instead I can see a result like 1440.
Thanks,
Blue in the sky
@GN0001 intck() will return the result that matches the source values. If you get a too big number then one of your two source variables contains another date than you think.
For the row where you have the problem print the values of your date variables like
put <var1> date9. <var1> f16.;
put <var2> date9. <var2> f16.;
Run a PROC CONTENTS on your dataset, and post the lines from the output describing the two variables.
Also post the values as they are displayed in a table viewer.
@GN0001 wrote:
Hello team,
I have two fields with date data types: their format is yyyy-mm-dd. I used intck function as monthdidd(month, startdate, finaldate). Some of the rows doesn’t show correct result . For example, it should show 10 months, it shows 1440. What is causing this?
appreciate your response.
blue in the sky
Provide the actual values that are doing this, both formatted and unformatted.
If this is happening with only a few values, I would guess that somewhere along the line that what was thought to be yymmdd type data was entered incorrectly. If it happens with almost ever pair of values then one starts to suspect that the source values may be in different formats but read with the same informat.
Also, show the entire data step where you are using the function and best would be to copy that from the log with all notes and then paste the entire log text into a text box opened on the forum with the </>.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.