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