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

I have following data set and want to calculate number of years from 31 march 2014 for each record from couponexpiry column.(USING INTCK FUNCTION)

Please revert with working solutions as soon as possible

thanks

 

storeidhlthfoodsizeorgcustidgendershopforvegstyleusecoupweekseqcarrycoupvalamtspentcouponexpiry
10221010131404215.2820/02/2014
10221010132443021/02/2014
10221010133432192.8122/02/2014
102210101344218.2423/02/2014
1022201013130316.7124/02/2014
10222010132331171.9125/02/2014
1022201013331412.8226/02/2014
1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

Adding a bit to @RW9

Your couponexpiry date variable would have to be a SAS date valued numeric. If your current value is character you will need to create a date value using input(couponexpiry,ddmmyy10.) before any calculations.

 

And the literal date used, '31MAR2014'd has to be in that form. You cannot use '31/04/2014' or 04/31/2014' or someother data appearance. It must be as displayed by either the SAS Date9. or Date7. format when using a literal value.

View solution in original post

3 REPLIES 3
RW9
Diamond | Level 26 RW9
Diamond | Level 26

Post test data in the form of a datastep for next time, follow:

https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-dat...

 

You code should look something like:

data want;
  set have;
  years=intck('year','31MAR2014'd,couponexpiry);
run;

 

ballardw
Super User

Adding a bit to @RW9

Your couponexpiry date variable would have to be a SAS date valued numeric. If your current value is character you will need to create a date value using input(couponexpiry,ddmmyy10.) before any calculations.

 

And the literal date used, '31MAR2014'd has to be in that form. You cannot use '31/04/2014' or 04/31/2014' or someother data appearance. It must be as displayed by either the SAS Date9. or Date7. format when using a literal value.

Nishant_saxena
Calcite | Level 5

This solution is working.

Thanks a lot

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!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 910 views
  • 0 likes
  • 3 in conversation