Hello!
I am completing an assignment where I have to use the set statement to combine three different data sets. One set is assigned with 0 for males, the second set assigns 1 for females, and the third is left blank for unknown gender. These were .sas files that I uploaded into SAS university edition. When I tried to use a set statement to combine them I get the error "ERROR: Variable Gender has been defined as both character and numeric."
i believe it is because the unknown data set for Gender has the variable as a character (see screenshot).
Is there any way of fixing this or changing this in sas so that it is numeric?
I also attached the unknown file below.
I apologize for the question, I am very new to SAS and trying but it has been a struggle.
Thank you!
Thanks so much for the help. This worked perfectly!
Please post more information about the datasets you are using. Posting data as data-step using datalines will help use to help you. Additionally explain what you want as result, which values are expected?
You could rename the numeric Gender variable:
set first second third (rename=(Gender=GenderNum));
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.
Find more tutorials on the SAS Users YouTube channel.