Learning SAS? Welcome to the exclusive online community for all SAS learners.

Use the DQGENDER Function in SAS University edition?

Reply
New Contributor
Posts: 3

Use the DQGENDER Function in SAS University edition?

Hi

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?

http://support.sas.com/documentation/cdl/en/dqclref/65068/HTML/default/viewer.htm#n17i7r8v1bqz7tn1g8...

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.

Best

Tom

SAS Super FREQ
Posts: 388

Re: Use the DQGENDER Function in SAS University edition?

Hi, Tom. That function is part of the SAS Data Quality server product, which isn't included in SAS University Edition.

Randy

New Contributor
Posts: 3

Re: Use the DQGENDER Function in SAS University edition?

Posted in reply to RandyMullis

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 helpSmiley Happy

Super User
Posts: 19,822

Re: Use the DQGENDER Function in SAS University edition?

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;

data name;

infile '/folders/myfolders/name_gender.txt' dlm=':' truncover firstobs=1;

informat name $25. gender $6.;

input name $ gender $;

run;

*manually add in data for names not in list;

data fill_in;

informat name $25. gender $7.;

input name $ gender $;

cards;

RUPINDER male

CHRISTIANNA female

SUNIL male

XUE female

TUESDI female

MARJE female

DMITRIY male

SUNIL male

PRADEEP male

GERHARD male

FALKO male

HEESUN male

RAJESH male

ZHENG male

MURALI male

XINMING female

PRASHANT male

XIANGXIANG male

ZUZU female

SANJAY male

MURALI male

IVOR male

GREGOR male

CHEVELL male

KRISA female

ZHIYONG male

JIFA male

ARVIND male

CHANGBIN male

YONGGANG male

FUNDA male

;

run;

*Combine two files;

data names;

set fill_in name;

run;

*Create dataset for proc format;

data name_fmt;

set names end=eof;

fmtname='name_fmt';

type='C';

start=name;

label=gender;

output;

if eof then do;

    output;

    HLO='O';

    label='Unknown';

    output;

end;

run;

proc sort data=name_fmt nodupkey;

by start;

run;

*Create format;

proc format cntlin=name_fmt;

run;

New Contributor
Posts: 3

Re: Use the DQGENDER Function in SAS University edition?

Hi Reeza

Thank you for the replySmiley Happy

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 helpSmiley Happy

Best Tom

Super User
Posts: 19,822

Re: Use the DQGENDER Function in SAS University edition?

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.

Ask a Question
Discussion stats
  • 5 replies
  • 521 views
  • 3 likes
  • 3 in conversation