Hello
I have 2 date variables formatted as datetime20 and am trying to find the number of days between the two dates. Below is sample data and code that doesn't work. I keep getting an error saying "There was a problem with the format so BEST. was used."
Patient HET DISCH_DHMS
1
2
3
data finalbicopd; set finalbicopd;
los=intck('day', datepart(HET), datepart(DISCH_DHMS), 'C');
run;
If the values are actually datetimes, both of them then the interval to use is 'dtday', which tells SAS both values are datetimes and that you want the day intervals.
Anytime you get an 'error' or other message you do not understand copy the data step or procedure code along with ALL the messages generated by the step or proc, open a text box on the forum with the </> icon and paste all of the text.
Since you do not show anything explicitly using formats anywhere I suspect you may have issue with one of your variables. You may need to run proc contents on the source data set and check.
However since you used the code
data finalbicopd; set finalbicopd;
you have completely replace the Finalbicopd data set and the attributes may not be as they were.
I suspect you are getting a WARNING, not an error. There is indeed a difference. in SAS. Errors would keep the data step from running.
Thanks - attached is the error message I get even after I submit other statements to sas (proc univariate, etc). It won't stop listing this as an error until I quit the "submitted statements."
Please don't post photographs of text. And if you do have to post photographs do it by clicking on the camera icon in the editor bar instead of inserting the photograph into the a word file and attaching the word file to your posting.
Please show the type, length (and any formats if any are attached) for your source variables.
Quote from @Tom 's post:
open a text box on the forum with the </> icon
It is this button that you HAVE to use when posting logs:
The "little running man" right next to it is for posting SAS code. ALWAYS use this button to post code. Do NOT post pictures of code or logs, always copy/paste the text. It makes helping ypu easier and will get you quicker answers.
Since your original code has no format reference in it, your problem has to come from the input dataset. Most likely there is a custom format attached to one or more variables, but the FMTSEARCH option is not properly set (or the format is not defined in your environment at all), so SAS can't find it.
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!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.