DATA Step, Macro, Functions and more

Need assistance

Reply
Occasional Contributor
Posts: 6

Need assistance

what exactly I need is. Here is the problem:

Input name $ status ;
Cards;
Aa active
Aa active
Aa active
Aa active
Aa active
Bb deactivated
Bb deactivated
Bb deactivated
Dd deactivated
Dd deactivated
Ee active
Ee active
Ee active
Cc active
Cc active
;
Run;

O/p should be like this


Aa active
Aa active
Aa active
Aa active
Aa active
Cc active
Cc active
Cc active
Ee active
Ee active
Ee active
Ee active
Ee active
Cc active
Cc active

How do we do that?
Trusted Advisor
Posts: 1,128

Re: Need assistance

try to use the below if condition

if index(status,'active')>0;
Thanks,
Jag
PROC Star
Posts: 551

Re: Need assistance

If I understand your request correctly, you you want to do this:

 

Anytime status is active you dont do anything.

Anytime status is deactivated you want to alphabetically increase name, so that Aa becomes Bb and so on.

 

Am I correct?

Occasional Contributor
Posts: 6

Re: Need assistance

It's not necessary the name should be in alphabetical order. If you look at
the raw data carefully what I need is whenever the status shows deactivated
it should be assigned to the person who is active.

##- Please type your reply above this line. Simple formatting, no
attachments. -##
Occasional Contributor
Posts: 6

Re: Need assistance

It's not necessary the name should be in alphabetical order. If you look at
the raw data carefully what I need is whenever the status shows deactivated
it should be assigned to the person who is active.

##- Please type your reply above this line. Simple formatting, no
attachments. -##
Super User
Posts: 6,936

Re: Need assistance

Is there a rule for how the "active" person for a given inactive person is determined? Next in order, least used, ...?

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Ask a Question
Discussion stats
  • 5 replies
  • 146 views
  • 0 likes
  • 4 in conversation