01-24-2015 06:31 AM
A simple question
I have a dataset containing a variable 'Sex', with values 1 and 2 (this is a numerical variable)
I want to change the contents of the variable to Female if Sex=1 and Male if Sex =2.
So the type of the variable will need to be changed too
Any simple way of doing it (without creating a temporary dummy variable?)
01-24-2015 08:13 AM
It is the way mentioned in sas doc
may i ask what is the problem with this way?
You can do the convert also in PROC SQL
check this old thread
01-24-2015 09:03 AM
Not sure of your question.
Do you want a solution like this?
value num2ch 1 = 'Female'
2 = 'Male'
format Sex num2ch.
proc print data = want;
proc contents data = want;
But the type of SEX is still Number in WANT data set.
01-24-2015 01:54 PM
Not really without temporary variables.
You can use a format to change the display, depending on what you're doing, a Class statement in many procs will accomplish this automatically.