Hi ,
I need to put a condition in my sql code for not fetching the vlaue 'P' for a column clm_ind, tried<> and also not in in the where conditions but its not working. The column in charector with a length of 1. Tried with strip(clm_ind) not in 'P' but not working . Please advice me what would be the problem
Thanks.
Your working code is a random win, it is not the solution or the issue.
Try this (pseudocode since I don't have SAS currently):
WHERE UPCASE(SUBSTR(STRIP(CL_CONV_CLAIM_IND),1,1) ) <> 'P'
That will tell us what is happening. My guess is that the claim code field is not a length of 1 but a format of $1 so it looks like 1 when it is not.
Please show your code and ideally data that replicates the issue.
WHERE
CL.CL_CLAIM_STATUS_CD IN ('O', 'R')
AND (CL.CL_CONV_CLAIM_IND) <>'P'
The above (claim_status) condition is working but the claim conv not working
The conv column has values like P,Blank and N
I would try the SAS 'not equals' operator, although I doubt that's the issue.
Check the data type/format. Is there a format applied, if so, you need the underlying value. Or check if there's trailing spaces with TRIM()
where trim(x) ne 'P'
Hi used the code but stil no luck. The data format is charector ($1.)
Hi Team , the below code I applied and it got worked , Could somebody explains me how it worked
COALESCE(CL_CONV_CLAIM_IND,'') <> 'P'
Your working code is a random win, it is not the solution or the issue.
Try this (pseudocode since I don't have SAS currently):
WHERE UPCASE(SUBSTR(STRIP(CL_CONV_CLAIM_IND),1,1) ) <> 'P'
That will tell us what is happening. My guess is that the claim code field is not a length of 1 but a format of $1 so it looks like 1 when it is not.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.