# Algorithm to categorize respondents into segments based on survey question responses

I have a segmentation scheme that uses four survey questions that categorize respondents into one of five segments. I want to be able to score respondents into the segments within the survey so that I can report survey results sliced by the segments in my Qualtrics dashboard. I created five variables that score respondents based on their responses, each variable is assigned to one of the five segments. Respondents are classified into the segment in which they score the highest. Thus, a respondent is in segment 1 if the value of X is their highest score:

Segment = 1 if X is greater than Y and X is greater than Z and X is greater than A and X is greater than B

Segment = 2 if Y is greater than X and Z is greater than Z and Y is greater than A and Y is greater than B

Segment = 3 if Z is greater than X and Z is greater than Y and Z is greater than A and Z is greater than B

Segment = 4 if A is greater than X and A is greater than Y and A is greater than Z and A is greater than B

Segment = t 5 if B is greater than X and B is greater than Y and B is greater than Z and B is greater than A

I expected that I would be able to create a variable Segment and use the logic method to compare X to Y, etc., but it only allows me to compare X to a constant.

Help!