DATA Step, Macro, Functions and more

Determining if two categorical variables are the same

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 15
Accepted Solution

Determining if two categorical variables are the same

I want to determine whether 2 categorical variables are the same. For example, for the dataset below called FRUIT, I want the group variable to be 1 if they are the same (fruit1 and fruit2 are identical) and 2 if they are not.

 

fruit1fruit2group
AppleApple 
BananaApple 
OrangeOrange 

 

Cheers


Accepted Solutions
Solution
‎06-19-2017 09:38 PM
PROC Star
Posts: 265

Re: Determining if two categorical variables are the same

if fruit1 =fruit2 then group = 1;

else group=2;

View solution in original post


All Replies
Solution
‎06-19-2017 09:38 PM
PROC Star
Posts: 265

Re: Determining if two categorical variables are the same

if fruit1 =fruit2 then group = 1;

else group=2;

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 1 reply
  • 125 views
  • 1 like
  • 2 in conversation