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-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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