BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
learner3
Fluorite | Level 6

can anyone write the code to find the differences between those dates.

data arjun;
input startday:$10. endday:$10. ;
datalines;
11jan2012 30jan2012
12jan2012 30jan2012
11mar2012 30mar2012
12apr2012 30may2012
31mar2022 15may2022
31mar2022 25may2022
;
run;

1 ACCEPTED SOLUTION

Accepted Solutions
japelin
Rhodochrosite | Level 12
data want;
  set arjun;
  dif=intck('day',input(startday,date9.),input(endday,date9.));
run;

View solution in original post

3 REPLIES 3
japelin
Rhodochrosite | Level 12
data want;
  set arjun;
  dif=intck('day',input(startday,date9.),input(endday,date9.));
run;
ballardw
Super User

Really want to get in the habit of reading dates as SAS dates and assigning your desired display format. There are several functions that work with dates, times and datetime values, and you can accomplish many analysis, reporting or graphing changes with data by changing the format of the date, time or datetime variables.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 289 views
  • 2 likes
  • 3 in conversation