BookmarkSubscribeRSS Feed
Divyanshu870
Calcite | Level 5
Hello everyone
Can u help me in finding difference between the dates
I have attached the file
3 REPLIES 3
PaigeMiller
Diamond | Level 26

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.

 

 

--
Paige Miller
ballardw
Super User

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

 

Tom
Super User Tom
Super User

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.

SAS Innovate 2025: Register Now

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!

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 524 views
  • 0 likes
  • 4 in conversation