Hi All,
I have a large data and I would like to split into two parts, one will be for the people who were active in 12 months and another will be the people who were not active. So if the member has 12 months = active if not member is inactive. I would like to add another column indicating active, inactive Here's an example of my data. Any help is appreciated.
ID# | MONTH |
12 | January 1, 2011 |
12 | February 1, 2011 |
12 | March 1, 2011 |
12 | April 1, 2011 |
12 | May 1, 2011 |
12 | June 1, 2011 |
12 | July 1, 2011 |
12 | August 1, 2011 |
12 | September 1, 2011 |
12 | October 1, 2011 |
12 | November 1, 2011 |
12 | December 1, 2011 |
13 | January 1, 2011 |
13 | February 1, 2011 |
13 | March 1, 2011 |
13 | April 1, 2011 |
14 | March 1, 2011 |
14 | April 1, 2011 |
14 | May 1, 2011 |
14 | June 1, 2011 |
Does your data only have the 12 months you care about in it? are there unique entries?
If not you can just count how many times a member is present.
proc sql;
create table want as
select id, month, case when count(id) =12 then 'Active' else 'Inactive' end as status
from have
group by id;
quit;
Does your data only have the 12 months you care about in it? are there unique entries?
If not you can just count how many times a member is present.
proc sql;
create table want as
select id, month, case when count(id) =12 then 'Active' else 'Inactive' end as status
from have
group by id;
quit;
Thanks Reeza that was great help. I did a little tweak and worked. Again thanks all 🙂
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.