BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
wlierman
Lapis Lazuli | Level 10

I am trying to execute a query to search for keywords from ICD10 codes and receive the error written in the Subject line. My query follows:

 

Proc sql noprint;
Create table NCI_Out.Conditions_Flags As
Select Distinct RecipientID,
ClaimType As Condition Label 'Condition',
Gender,
Medicare_status,
Month,
CASE
When Primary_Dx_Desc Like '*Depress%'
Then Condition = 'Depression'
Else ' '
End As BI12_01,
Case
When Primary_Dx_Desc Like '*Schizo%'
Then Condition = 'Schizophrenia'
Else ' '
End As BI12_02,
Case
When Primary_Dx_Desc Like '*BiPol%'
Then Condition = 'BiPolar'
Else ' '
End As BI12_03,
Case
When Primary_Dx_Desc Like '*Mood%'
Then Condition = 'Mood_Disorder'
Else ' '
End As BI12_04,
Case
When Primary_Dx_Desc Like '*Anxiety%'
Then Condition = 'Anxiety_Disorder'
Else ' '
End As BI12_05,
Case
When Primary_Dx_Desc Like '*Chemical%'
Then Condition = 'Chemical_Dependence'
Else ' '
End As BI12_06,
Case
When Primary_Dx_Desc Like '*Opiate%'
Then Condition = 'Chemical_Dependence'
Else ' '
End As BI12_06a,
Case
When Primary_Dx_Desc Like '*Opiod%'
Then Condition = 'Chemical_Dependence'
Else ' '
End As BI12_06b
From NCI_Out.ICD10_Text_Check_ok
Order by RecipientID, Month;
Quit;Proc sql noprint;

 

I appreciate any help that is offered.

1 ACCEPTED SOLUTION

Accepted Solutions
Tom
Super User Tom
Super User

So the ELSE clause is specifying a character string, but after the THEN you have a boolean expression that is testing whether the variable Condition has the value 'Depression' or not.

 

I assume that you actually meant:

when Primary_Dx_Desc like '*Depress%' then 'Depression'
else ' '
end as BI12_01

View solution in original post

3 REPLIES 3
ballardw
Super User

It may help to show the entire Proc SQL from the log along with all error messages or notes. Best is to copy from the log and paste into a code box opened using the forum's {I} or "running man" icon to preserver the formatting of any error messages. Many errors include indicators of where the problem was detected and the main message windows will reformat text moving the indicators.

 

 

Tom
Super User Tom
Super User

So the ELSE clause is specifying a character string, but after the THEN you have a boolean expression that is testing whether the variable Condition has the value 'Depression' or not.

 

I assume that you actually meant:

when Primary_Dx_Desc like '*Depress%' then 'Depression'
else ' '
end as BI12_01
wlierman
Lapis Lazuli | Level 10

Tom,

 

Thank you for the post. 

 

Making the change you provided cleared up the error.

 

Thank you for the solution.

 

Walt

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
Mastering the WHERE Clause in PROC SQL

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.

Discussion stats
  • 3 replies
  • 2172 views
  • 0 likes
  • 3 in conversation