BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
AliMN
Calcite | Level 5

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

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

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;

View solution in original post

2 REPLIES 2
Reeza
Super User

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;

AliMN
Calcite | Level 5

Thanks Reeza that was great help. I did a little tweak and worked. Again thanks all 🙂

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
  • 2 replies
  • 535 views
  • 1 like
  • 2 in conversation