05-03-2015 08:22 AM
I'm doing a customer profitability analysis using SAS as a part of my master thesis.
We have a customer list that doesn't consist the gender of the individual customers and want to set the parameter gender in some way.
As far as I understand can this be done by the DQGENDER Function?
Is that function possible to use in the SAS University edition?
And how do you do this in the University edition:
The specified locale must be loaded into memory as part of the locale list.
05-04-2015 08:13 AM
Hi, Tom. That function is part of the SAS Data Quality server product, which isn't included in SAS University Edition.
05-04-2015 09:51 AM
Thank you for the answer, Randy.
Do you have suggestion for how I can write a function that does the same in SAS Studio in an effektive way?
I have the given names listet in one column in the database and 2 lists of the 300 most common given names for male and females.
I want to create a query that checks the the given name column against the "two gender names lists" and return a value of Male, Female or none (if the name isn't at any of the lists). I will afterwords set the gender manually at the rows where "none" is returned.
Thanks in advance for all help
05-04-2015 11:22 AM
A proc format can do that, combine your lists into one and create a format. I did something similar a while ago, the code is below that you'll need to adapt to your data. Mine is based on first name though. Personally, I don't think surname - family name - is a great way to assign gender though. Given name may be more appropriate.
*import master list of names;
infile '/folders/myfolders/name_gender.txt' dlm=':' truncover firstobs=1;
informat name $25. gender $6.;
input name $ gender $;
*manually add in data for names not in list;
informat name $25. gender $7.;
input name $ gender $;
*Combine two files;
set fill_in name;
*Create dataset for proc format;
set names end=eof;
if eof then do;
proc sort data=name_fmt nodupkey;
proc format cntlin=name_fmt;
05-05-2015 07:28 AM
Thank you for the reply
I mixed up given name and surname in my post. I of course ment to use given name to detect gender (now edited).
Just a little question to the code you provided:
-I'v got the first steps where you import the namelist and merge it with the liste of name specified in the SAS code, into the table named "names"
-But the next section where I want to check my "customer register file" against this file is a bit unclear to med.
-How can I write a query where i check the value in the name colum in my SAS table customerRegister agains the "names" list and return the gender fram the list, or unknown if the name is not on the list?
Again, thank you for all help
05-05-2015 12:10 PM
Format is applied with the PUT function.
gender = put(name, $name_fmt.);
EDIT: You'll need to make sure you account for differing case - i.e. upcase or lowercase all the data/proc format dataset.