SUPPORT / SAMPLES & SAS NOTES
 

Support

Problem Note 62800: "ERROR: Unable to convert a character value to a numeric value..." occurs when you use an IN operator in PROC FCMP

DetailsHotfixAboutRate It

When you run the FCMP procedure under the following conditions, an error occurs:

  • You use an IN operator.
  • A variable on the right side is uninitialized.
  • The variable types on the left side and on the right side are different (for example, one side has numeric variables and the other has character variables).

Here is the error that you receive:

ERROR: Unable to convert a character value to a numeric value in statement...

This issue occurs because the type conversion is handled incorrectly. When a variable on the right side is uninitialized, its type is set to match the type of the left-side variable. If the left-side variable is numeric and the right-side variable is a character variable, then the types do not match. Then, when the IN operator is evaluated, literals in the IN list are incorrectly set to numeric rather than being reset to character. 

Here is an example. In the following program, if DEBQ is uninitialized, the type mismatch occurs. The mismatch occurs because X is numeric and DEBQ should be character. However, DEBQ is set to numeric even though the IN list contains all character types.

proc fcmp;
x = 123.123 * (debq in ("a", "b", "c"));
run;
quit;

Then, when the program is run, the log contains messages similar to the following:

NOTE: Character value converted to numeric for argument 2 of 'IN' operation.
NOTE: Character value converted to numeric for argument 3 of 'IN' operation.
NOTE: Character value converted to numeric for argument 4 of 'IN' operation.
ERROR: Unable to convert a character value to a numeric value in statement number 1 at line 53 column 1.
       The statement was:
    1     (53:1)     x = 123.123 * IN( debq=., Move N<=C("a"), Move N<=C("b"), Move N<=C("c") )
ERROR: Unable to convert a character value to a numeric value in statement number 1 at line 53 column 1.
       The statement was:
    1     (53:1)     x = 123.123 * IN( debq=., Move N<=C("a"), Move N<=C("b"), Move N<=C("c") )
ERROR: Unable to convert a character value to a numeric value in statement number 1 at line 53 column 1.
       The statement was:
    1     (53:1)     x = 123.123 * IN( debq=., Move N<=C("a"), Move N<=C("b"), Move N<=C("c") )

Click the Hot Fix tab in this note to access the hot fix for this issue.

After you install the hot fix, the type of variable in the IN clause will be evaluated by the variables in the IN list and not by the variable type on the left side.



Operating System and Release Information

Product FamilyProductSystemProduct ReleaseSAS Release
ReportedFixed*ReportedFixed*
SAS SystemBase SASz/OS9.4_M59.4_M69.4 TS1M59.4 TS1M6
z/OS 64-bit9.4_M59.4_M69.4 TS1M59.4 TS1M6
Microsoft® Windows® for x649.4_M59.4_M69.4 TS1M59.4 TS1M6
Microsoft Windows 8 Enterprise 32-bit9.4_M59.4_M69.4 TS1M59.4 TS1M6
Microsoft Windows 8 Enterprise x649.4_M59.4_M69.4 TS1M59.4 TS1M6
Microsoft Windows 8 Pro 32-bit9.4_M59.4_M69.4 TS1M59.4 TS1M6
Microsoft Windows 8 Pro x649.4_M59.4_M69.4 TS1M59.4 TS1M6
Microsoft Windows 8.1 Enterprise 32-bit9.4_M59.4_M69.4 TS1M59.4 TS1M6
Microsoft Windows 8.1 Enterprise x649.4_M59.4_M69.4 TS1M59.4 TS1M6
Microsoft Windows 8.1 Pro 32-bit9.4_M59.4_M69.4 TS1M59.4 TS1M6
Microsoft Windows 8.1 Pro x649.4_M59.4_M69.4 TS1M59.4 TS1M6
Microsoft Windows 109.4_M59.4_M69.4 TS1M59.4 TS1M6
Microsoft Windows Server 20089.4_M59.4 TS1M5
Microsoft Windows Server 2008 R29.4_M59.4 TS1M5
Microsoft Windows Server 2008 for x649.4_M59.4 TS1M5
Microsoft Windows Server 2012 Datacenter9.4_M59.4_M69.4 TS1M59.4 TS1M6
Microsoft Windows Server 2012 R2 Datacenter9.4_M59.4_M69.4 TS1M59.4 TS1M6
Microsoft Windows Server 2012 R2 Std9.4_M59.4_M69.4 TS1M59.4 TS1M6
Microsoft Windows Server 2012 Std9.4_M59.4_M69.4 TS1M59.4 TS1M6
Microsoft Windows Server 20169.4_M59.4_M69.4 TS1M59.4 TS1M6
Windows 7 Enterprise 32 bit9.4_M59.4_M69.4 TS1M59.4 TS1M6
Windows 7 Enterprise x649.4_M59.4_M69.4 TS1M59.4 TS1M6
Windows 7 Home Premium 32 bit9.4_M59.4_M69.4 TS1M59.4 TS1M6
Windows 7 Home Premium x649.4_M59.4_M69.4 TS1M59.4 TS1M6
Windows 7 Professional 32 bit9.4_M59.4_M69.4 TS1M59.4 TS1M6
Windows 7 Professional x649.4_M59.4_M69.4 TS1M59.4 TS1M6
Windows 7 Ultimate 32 bit9.4_M59.4_M69.4 TS1M59.4 TS1M6
Windows 7 Ultimate x649.4_M59.4_M69.4 TS1M59.4 TS1M6
64-bit Enabled AIX9.4_M59.4_M69.4 TS1M59.4 TS1M6
64-bit Enabled Solaris9.4_M59.4_M69.4 TS1M59.4 TS1M6
HP-UX IPF9.4_M59.4_M69.4 TS1M59.4 TS1M6
Linux for x649.4_M59.4_M69.4 TS1M59.4 TS1M6
Solaris for x649.4_M59.4_M69.4 TS1M59.4 TS1M6
* For software releases that are not yet generally available, the Fixed Release is the software release in which the problem is planned to be fixed.