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?
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.