BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
awmeyertimmy
Fluorite | Level 6
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

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

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.

View solution in original post

4 REPLIES 4
ballardw
Super User

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.

awmeyertimmy
Fluorite | Level 6

Works great! Thanks!

SuryaKiran
Meteorite | Level 14

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

Thanks,
Suryakiran
Tom
Super User Tom
Super User

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;

SAS Innovate 2025: Register Now

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!

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 3453 views
  • 2 likes
  • 4 in conversation