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;
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.