BookmarkSubscribeRSS Feed
BrahmanandaRao
Lapis Lazuli | Level 10

Hi Guys

 suppose a person visit respective dates I want to count no of days between two dates

 required answer is 2 days as per below dates 

data count;
st_date ='01JAN2021'd;
end_date='02JAN2021'd;
fromat st_date end_date date9.;
count_total=intck('day',st_date,end_date);
put count_total= ;
run;
3 REPLIES 3
BrahmanandaRao
Lapis Lazuli | Level 10

suppose three days then 

data count;
1st_date ='01JAN2021'd;
2nd__date='02JAN2021'd;
3rd_date='05APR2021'd;
fromat 1st_date 2nd_date 3rd_date date9.;
count_total=intck('day',st_date,end_date)+1;
put count_total= ;
run;
Kurt_Bremser
Super User

Apart from the obvious syntax error in the FORMAT statement, this code will only create missing values.

STRONGLY suggest you run your code in your SAS environment and see what it does (Maxim 4).

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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
  • 892 views
  • 0 likes
  • 2 in conversation