Replace Yes with 1 and No with 0 I have a data set and an example of the field is below. The values of these fields is &quot;Yes&quot; or &quot;No&quot;. I would like to replace the value of &quot;Yes&quot; with 1 and the value of &quot;No&quot; with 0.
This file will be exported from Sharepoint each month and at the moment it is 50,000 rows and will increase each month. I have 48 fields which I would like to do the replace of &quot;Yes&quot; and &quot;No&quot;.
Example of the field
t1.'Domestic Violence'n, 

I'm using the below to accomplish what I'd like, but was hoping there is a better way to do this. Ideally, I don't want to create another column.
I am using SAS. For example:
 t1.'Domestic Violence'n as DomesticViolence, 
      case when(DomesticViolence='Yes') then 1
        else 0
        end as Domestic_Violence,

I would like a more efficient way (less coding). With the above I'll have a column called 'DomesticViolence' (values of &quot;Yes&quot; and &quot;No&quot;) and  a column called 'Domestic_Violence'. Ideally I'd only want the column called 'Domestic_Violence'.
If you do not want to return both Yes/Nos and 1/0s, then exclude columns like

t1.'Domestic Violence' as DomesticViolence


from your query and have your CASE expression reference the source columns rather than their aliases:

case
  when (t1.'Domestic Violence' = 'Yes') then 1
  else 0
end as Domestic_Violence