Hi team,
I have a dataset with startdate and enddate of certain task.All i wanted to know is the no of days between start and end of each task.But my input sas dataset contains date as character variable,so when i applied datdif function on the start and end date vars imk getting errors.Even tried to apply input function before executing Datdif function.
"Even tried to apply input function before executing Datdif function."
You're on the right track with this one. All SAS calendar functions like datdif() and intck() require the data to be a SAS date or SAS datetime value (=number of days or number of seconds since 1/1/1960).
The INPUT() function will help you to convert a character string into such a numeric SAS date/datetime value. You just need to apply the correct INFORMAT which instructs SAS how to convert this string into a date/datetime value.
Should you require more guidance: You need to post sample data (a data step creating such data) and then explain us what you need.
Hey Patrick !!! thanks for the response.Issue resolved with your guidance..
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.