Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
b_garside
Partner - Specialist
Partner - Specialist

Combine multiple fields into one common field

I have several Race fields that should be combined into one common field since they have a common attributes.

The problem is how do I combine the Six fields when they have a Y/N value for each one and map it to the label of the fields?

Current Schema:

FieldValue
Race: WhiteY/N
Race: BlackY/N
Race: HispanicY/N
Race : AsianY/N
Race : IndianY/N
Race: OtherY/N
Convert to This:
Values
RaceWhite
Black
Hispanic
Asian
Indian
Other
4 Replies
its_anandrjs

Hi,

Please explain the field names or you can use subfield here

This data in which two fields

Current Schema:

Race: WhiteY/N
Race: BlackY/N
Race: HispanicY/N
Race : AsianY/N
Race : IndianY/N
Race: OtherY/N

Regards

Anand

b_garside
Partner - Specialist
Partner - Specialist
Author

If I have 6 fields that have 6 Y/N values I want to convert them into one field that has the descriptions instead.

I can create a mapping table as well to help.

Would like the data to be stored like this.

FieldValue
RaceWhite
Black
Hispanic
Asian
Indian
Other
its_anandrjs

Can you explain with table structure that will be great.

Regards

Anand

prieper
Master II
Master II

You may use a crosstable-approach, but with this limited amount of criteria, would go with a plain approach:

Data:

LOAD

  Attrib1,

  Attrib2,

  IF(IsWhite = 'y', 'White') & IF(IsBlack = 'y', 'Black') & IF(IsIndian = 'y', 'Indian') AS Race

INLINE [Attrib1, Attrib2, IsWhite, IsBlack, IsIndian

     a, aa, y, n, n

     b, bb, y, n, n

     c, cc, n, y, n

     d, dd, n, n, y];

HTH Peter