Proc SQL; Create table Results.VarResultsCL as SELECT AppVintage format = $CHAR24. ,Strategy format = $CHAR24. ,Approval_Rate_Diff format = percent12.2 ,Activation_Rate_Diff format = percent12.2 FROM Portrevw.awm_aa_variance_cl; quit;
I am using that code to create a SAS data set. However, when I run it, I get this error:
ERROR: Numeric expression requires a numeric format.
The format from the SQL table for AppVintage is datetime, null
The format for approval_Rate_Diff and activation_rate_diff is decimal(5,4),null
Can anyone help?
Thanks!
a
If your AppVintage is a datetime then the value is numeric and so you cannot assign $char format. You likely would want something like DATETIME20. (or a larger number if you need to see decimal second values).
If your Strategy variable is actually numeric you would have the same error.
If your AppVintage is a datetime then the value is numeric and so you cannot assign $char format. You likely would want something like DATETIME20. (or a larger number if you need to see decimal second values).
If your Strategy variable is actually numeric you would have the same error.
Works great! Thanks!
Hi,
Most cases DBMS have datetime even there is no time(0's), if this is your case or if you don't need the time and need only the date then use DATEPART() function.
DATEPART(AppVintage) format=DATE9. as Appvintage
Why attach any formats? Why not just use the formats that SAS figures out from looking into the external database?
proc sql;
create table Results.VarResultsCL as
select
AppVintage
,Strategy
,Approval_Rate_Diff
,Activation_Rate_Diff
from Portrevw.awm_aa_variance_cl
;
quit;
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.