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-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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