Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
MK9885
Master II
Master II

If match condition

Hello,

I've a requirement to match 2 different fields and make it as one field.

One of the field is calculated based on MATCH condition

Cross Table (Field1, Class)

Load ID,

Match(Field1,'A','B','C') as ABC,

Match (Field1,'A','B','C','D') as CDE,

Match (Field1,'A','B','C','D') as Total

Resident Table1;

I've another field called Gender which has values Male/Female

I want to match Gender to Field1

So if Gender is Male/Female they should match to ABC, CDE and Total based on Selection Cus Gender can be ABC or CDE and also they fall under Total.

In the end I'm looking for Field1= ABC,CDE, Total and Female

Gender is a different field and Field1 is a different field but gender can match to any value inside Field1.

Please help.

neelamsaroha1575loveisfail

Thanks.

3 Replies
Anil_Babu_Samineni

I didn't get your question, Better to provide the data set and result set may be?

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
MK9885
Master II
Master II
Author

If I've 4 values in a Field, I want to match it with other values in other field.

Ex: Field1 = A, B, C, D

      Field2= 1,2

I want to match Field2, 1 to A, B, C, D and Field2, 2 to A, B, C, D

Cus in Field2, 1 and 2 can also be A or B or C or D

In my case

Field2 is Gender who are Male and Female

Field1 is Ethnicity who are white, black, lationo, hispanic etc...

So a Gender who are male and female can also be Black or Hispanic or White etc

I already created a field with Match function using cross table cus for my req, Black fall under People of Color, Hispanic fall under people of color and White fall under other category. So multiple values are created as 1 value < Solved.

But now I've to Map Gender to these multiple values.

Ethnicity to map to Gender.

Create a new field which should have all ethnicty plus only Females.

New Field

Black

White

Hispanic

Latino

Total (All ethnicity including white)

People of Color (All ethnicity excluding white + all genders)

Women (Only womens who are total and people of color)

Anonymous
Not applicable

I don't know if I understand why you're doing a crosstable.

Why wouldn't you keep your data of ID, Gender, Ethnicity?

Then use set analysis in your charts.

like count({Gender={'Female'},Ethnicity-={'White'}>} ID)

Or even if you really wanted it in your script, I probably woudn't do a crosstable either.  I would just do IF statements

I would do:

Load

     ID,

     Gender,

     Ethnicity,

     if(Gender='Female' and not match(Ethnicity,'White'), 1,0) as FemalePOC,

     if(not match(Ethnicity,'White'), 1,0) as POC,

     1 as Total

Resident Table1;