Some of us (like me) will not download attached files, so I can't see your data. Please include the data in your reply as plain text, following these examples and instructions.
Also, please be specific and explain what you want as output, provide an example of the "difference" or "differences" you want to see.
Your code in the attachment shows "date" as character values. So you really need to define what you mean by difference.
If the values are actual SAS date values then you can get all sorts of intervals from different date values. If the values were actual SAS date values then you could use the DIF function to get number of days since the previous record.
@Divyanshu870 wrote:
Hello everyone
Can u help me in finding difference between the dates
I have attached the file
Why do to the trouble to make a photograph of text, store it in a PDF file and then upload the file?
Just copy and past the text into the forum editor. Use the Insert SAS Code icon to get a pop-up window to paste/edit the code so its formatting is retained.
Your example program is not reading in dates. It is instead making a character variable named DATE. To make a numeric variable use the DDMMYY informat. Then attach a format to the numeric variable so it prints in a way that humans will understand. Avoid using DDMMYY or MMDDYY format as either one will confuse half of your audience. Use the DATE format or the YYMMDD format instead and avoid the confusion.
Once you have date values then you can just subtract them to find the difference in days between the two dates.
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.
Ready to level-up your skills? Choose your own adventure.