@deenap29 wrote:
I was looking at the tables/fields again and realized that
t1 work.query for all closed has numeric and alphabet then numbers at the very end (starting with Y). Should I follow the same logic as before as you mentioned above?
What are you trying to do?
If you just want to use COALESCE() to report whichever non-missing value is first among your list of fields then convert everything to character strings.
left(put(numvar,best32.))
But if you need to actually preform arithmetic (or find min, max, mean, sum, etc) with those values then you will need to convert the characters to numbers. How to do that really depends on what is meaning of the a letter followed by digits. If they really are in the form A9999 then perhaps you can just use SUBSTR() to skip the first letter.
input(substr(charvar,2),32.)
You should also investigate what about your earlier processes is resulting in you having mixed data types for variables that you consider as capturing equivalent information. Are you using PROC IMPORT or some other guessing procedure to create your datasets? Perhaps you could convert those steps to data steps so you can explicitly define the data types for the variables.
It worked!!!!
Thank you again very much for your patience and help with this! I appreciate it!!
For the case statement below, I keep getting the error in red. Not sure where a then is missing? Please help!!!
70 /* Include Owner? */
71 (CASE
72 WHEN THEN 'N'
___
79
73 WHEN THEN 'N'
___
79
ERROR 79-322: Expecting a THEN.
74 WHEN '949 IRVING' = t1.current_owner_fn THEN 'N'
75 WHEN 'CLAIMS INTAKE - LIBERTY MUTUAL (CL)' = t1.current_owner_fn THEN 'N'
76 WHEN 'CLAIMS INTAKE - LIBERTY MUTUAL (CL) SUPPORT' = t1.current_owner_fn THEN 'N'
77 WHEN 'GENERAL AM INBOX - LIBERTY MUTUAL (CL)' = t1.current_owner_fn THEN 'N'
78 WHEN 'LIBERTY MUTUAL COMMERCIAL SUBRO' = t1.current_owner_fn THEN 'N'
79 WHEN 'LIBERTY MUTUAL INS - COMMERCIAL CLAIMS' = t1.current_owner_fn THEN 'N'
80 ELSE 'Y'
81 END) FORMAT=$CHAR43. LABEL="Include Owner?" AS 'Include Owner?'n,
Case statement:
CASE
WHEN THEN 'N'
WHEN THEN 'N'
WHEN '949 IRVING' = t1.current_owner_fn THEN 'N'
WHEN 'CLAIMS INTAKE - LIBERTY MUTUAL (CL)' = t1.current_owner_fn THEN 'N'
WHEN 'CLAIMS INTAKE - LIBERTY MUTUAL (CL) SUPPORT' = t1.current_owner_fn THEN 'N'
WHEN 'GENERAL AM INBOX - LIBERTY MUTUAL (CL)' = t1.current_owner_fn THEN 'N'
WHEN 'LIBERTY MUTUAL COMMERCIAL SUBRO' = t1.current_owner_fn THEN 'N'
WHEN 'LIBERTY MUTUAL INS - COMMERCIAL CLAIMS' = t1.current_owner_fn THEN 'N'
ELSE 'Y'
END
Your first two rows do not have any condition specified. I assume that the parser is considering the text THEN as the name of a variable to evaluate as the condition and that is why it is complaining that there is no THEN.
Thank you! I have a DATEPART question for you. It worked in the first part of the formula but not in the second after THEN. Im basically trying to get rid of the timestamp so the valuation month and year populate instead of being blanks.
CASE
WHEN t1.'ANS RCVD'n IS MISSING AND Year(DATEPART(t1.'ANS DUE'n)) < 2013 THEN INTNX('month',t1.CLOSED,0,'E')
WHEN t1.'ANS RCVD'n IS MISSING AND Year(DATEPART(t1.'ANS DUE'n)) >= 2013 THEN INTNX('month',t1.'ANS DUE'n ,0,'E')
WHEN Year(DATEPART(t1.'ANS RCVD'n)) < 2013 AND Year(DATEPART(t1.'ANS DUE'n)) < 2013 THEN INTNX('month',t1.CLOSED,0,'E')
WHEN Year(DATEPART(t1.'ANS RCVD'n)) < 2013 AND Year(DATEPART(t1.'ANS DUE'n)) >= 2013 THEN INTNX('month',t1.'ANS DUE'n,0,'E')
ELSE INTNX('month',t1.'ANS RCVD'n,0,'E')
END
Thank you so much!!! it worked!!
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
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.