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 🙂
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.
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.