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

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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