05-10-2017 07:59 AM
I'm trying to set the values of a variable to MISSING ('') using the create format task.
the original table looks somewhat like
The Gender is classified as F for female, M for male, U or MISSING value for undefined.
I like to set all gender values of
'F' to 'female',
'M' to 'male' and
'U' or MISSING value to MISSING.
Afterwards the table should look like this
I tried to do so by using the create format task but if I leave the label for "all other values" empty I get two single quotaion marks ('') instead of empty entries. My table looks like
I wonder if it is possible to do this with the create format task or do ii have to use a CASE-WHEN-THEN-ELSE statement?
05-10-2017 08:32 AM
Sorry, I dont know what a "format task" is, not that familiar with EG anymore. However it is a very simple task in code:
proc format; value $gender "M"="male" "F"="female" other=" "; run; data want; set have; format gender $gender.; run;
05-10-2017 08:42 AM - edited 05-11-2017 03:07 AM
thanks for your answer.
I myself came from SAS Base and I know that it is easy to do in code.
What makes me wonder is that the EPG sets exactly the code you produced (see attached picture in orig post) but gives me two simple quotation marks instead of an empty entry.
05-10-2017 08:54 AM
Please select the all other values from the drop down where all other values is highlighted that way for other values we get the blank
05-11-2017 02:26 AM
I tried it the same way, but what happend was that for all other values I got two single quotation marks.
If I use a format created like you did (named $Gender.) I get the results as shown in the provided picture.
Code for column Gender_1:
WHEN t1.Gender_orig = 'W' THEN 'Weibl.'
WHEN t1.Gender_orig = 'M' THEN 'Männl.'
Code for Gender_2:
Code for Gender_3:
use format $Gender. as output format