Hi all
I ran this query but i get the following error message. Can anyone assist me in correcting this?
, R.RACE01DSC as Race_Ethnicity LABEL= 'Race/Ethnicity'
,CASE WHEN RACE01DSC = 'ASIAN' THEN 'Asian'
WHEN RACE01DSC = 'BLACK OR AFRICAN AMERICAN' THEN 'Black or African American'
WHEN RACE01DSC = 'Hispanic or Latino' THEN 'Hispanic or Latino'
WHEN RACE01DSC LIKE ('WHITE%') THEN 'White or Caucasian'
WHEN RACE01DSC IN ('Declined', 'Unavailable') THEN 'Unknown'
WHEN RACE01DSC IS NULL THEN 'Unknown'
ELSE 'Other' END AS 'RACE'
______
22
ERROR 22-322: Expecting a name.
ELSE 'Other' END AS RACE
no quotes around a variable name.
Remove quotes around your variable name, RACE.
END AS RACE
Or add an N after it to tell SAS it's a valid variable name not a character string.
END as 'RACE'n
@wheddingsjr wrote:
Hi all
I ran this query but i get the following error message. Can anyone assist me in correcting this?
, R.RACE01DSC as Race_Ethnicity LABEL= 'Race/Ethnicity' ,CASE WHEN RACE01DSC = 'ASIAN' THEN 'Asian' WHEN RACE01DSC = 'BLACK OR AFRICAN AMERICAN' THEN 'Black or African American' WHEN RACE01DSC = 'Hispanic or Latino' THEN 'Hispanic or Latino' WHEN RACE01DSC LIKE ('WHITE%') THEN 'White or Caucasian' WHEN RACE01DSC IN ('Declined', 'Unavailable') THEN 'Unknown' WHEN RACE01DSC IS NULL THEN 'Unknown' ELSE 'Other' END AS 'RACE'
______
22
ERROR 22-322: Expecting a name.
Thanks Reeza and Kurt. That made the query run, however, the new column is populated with "Unknown" regardless what the Race_Ethnicty column is. How does that happen?
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.