BookmarkSubscribeRSS Feed
Karo_22
Calcite | Level 5


I have done a data step that would count member months for past 3 years. But I have been asked to make sure that my query does member month count as of 15th of each month...and I got suddenly confused and not sure of my code.

Here is what I am traying to achieve.

I have eligibility file for members , meaning all 3 year worth of data. I need to check if a member was active each month on the 15th of each month, for past 3 years. If so then he gets count of 1 for been active.

I have done something like this ,where effdt/end date in the data step is a field from the data set.

Data a;

     array mos [1:37] &monthlist;

set mbrcov ;

mcount=0

do I=1 to 37;

if intnx('month', 01mar10,I-1) > effdt and

intnx('month', 01mar10,I-1) < enddt then mos=1;

else mos=0;

mcount=mcount+mos;

end;

run;

How do I modify this so I check that is active on the 15th of each month? I think answer is right there in front of me,but I just don't see it after looking at it soo long. Thanks for advise.

1 REPLY 1
ballardw
Super User

I think you need to provide a little information about the structure of the data.

You may also want to look at the alignment option for intnx which can allow you compare to the same day of the month.

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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
  • 1 reply
  • 607 views
  • 0 likes
  • 2 in conversation