DATA Step, Macro, Functions and more

Getting possible combinations

Reply
Contributor
Posts: 55

Getting possible combinations

Hi, 

I would like to produce this want dataset from have. It's like affecting only name = COUPLE, but name = SINGLE should not be edited. 

 

data have;
input id name $;
cards;
1 SINGLE
2 COUPLE
3 COUPLE
;
run;

 

data want;
input id name $;
cards;
1 SINGLE
2 MAN
2 WOMAN
3 MAN
3 WOMAN
;
run;

 

Thank you

Super User
Posts: 19,817

Re: Getting possible combinations

Posted in reply to angeliquec

Use an explicit OUTPUT statement to override default. 

 

 

If name='COUPLE' then do;

name='MAN'; output;

Name='WOMAN'; output;

end;

else output;

Ask a Question
Discussion stats
  • 1 reply
  • 182 views
  • 1 like
  • 2 in conversation