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.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

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
  • 728 views
  • 0 likes
  • 2 in conversation