BookmarkSubscribeRSS Feed
UIC_SUG
Calcite | Level 5

Hello,

 

I have several datasets I need to stack, but in some the field is labeled Gender and either has 'M' or 'F' in the observations and in other datasets the field is Gender_DESC and 'Male' or 'Female' in the observations. I need to make sure the field name and values are consistent. Is there an easy way to compare the datasets and see what's inside the observations so I know what needs to be fixed?

 

Let me know if you have any questions.

 

Thanks

1 REPLY 1
Astounding
PROC Star

One possibility would be to take every data set that contains GENDER_DESC and create GENDER.  That's relatively simple:

 

length gender $ 1;

gender = gender_desc;

 

Then you could use the same process you use now to see if the GENDER values are equal.

 

There is a weakness to this approach.  By copying just the first character into GENDER, you may create the impression that all is OK when it is not.  For example:

 

length gender $ 1;

gender_desc = 'Molly';

gender = gender_desc;

 

GENDER will be "M" but there is no way to tell that GENDER_DESC is bad without examining in more detail.  Those sorts of comparisons are possible but are more complex to set up so the right solution may depend upon your being comfortable with more complex code.

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
How to choose a machine learning algorithm

Use this tutorial as a handy guide to weigh the pros and cons of these commonly used machine learning algorithms.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 1 reply
  • 823 views
  • 0 likes
  • 2 in conversation