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 2024

Innovate_SAS_Blue.png

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

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.

Get the $99 certification deal.jpg

 

 

Back in the Classroom!

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

View all other training opportunities.

Discussion stats
  • 3 replies
  • 619 views
  • 0 likes
  • 3 in conversation