BookmarkSubscribeRSS Feed
goliPSU
Calcite | Level 5

I have the FV_sectors (It has values as I have printed it), and the data in CONVENTION has icom and ccom where in some places I have icom which is including numbers in FV_sectors. I do not want to include them in SECTOR_LIST. but it is giving me the following error:

    print FV_sectors;

    use CONVENTIONAL;

    /* list of all commodities */

    read all var{cCom iCom} into SECTOR_LIST where ((iCom ^= FV_sectors)&(cCom ^= FV_sectors));

    num_sectors = sqrt(nrow(SECTOR_LIST));

error:

431  print FV_sectors;

432      use CONVENTIONAL;

433

434      /* list of all commodities */

435      read all var{cCom iCom} into SECTOR_LIST where ((iCom ^= FV_sectors)&(cCom ^=

435! FV_sectors));

ERROR: Type mismatch in WHERE clause for variable iCom.

statement : READ at line 435 column 5

436      num_sectors = sqrt(nrow(SECTOR_LIST));

Thank you

1 REPLY 1
Rick_SAS
SAS Super FREQ

Here's a debugging tip: Try to reproduce your error on a standard SASHELP data set such as Sashelp.Class or Sashelp.Cars.  Often this will enable you to figure out what is going on because the sample data is (a) familiar and (2) simple. Furthermore, even if you can't figure it out yourself, you'll be able to post an example that others can actually run, which will make it easier for them to debug.

For this example, I saw that the error says "type mismatch," which usually means comparing a numeric quantity with a character quantity.  Since I don't have your data, I don't know what types they are, but I was able to reproduce the problem with Sashelp.Class:

proc iml;
c = "USA"; /* character value */
use sashelp.cars;
read all var{mpg_city} into X where(mpg_city^= c);

I suspect that  iCom is numeric whereas FV_Section is character, or vice versa.

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

Multiple Linear Regression in SAS

Learn how to run multiple linear regression models with and without interactions, presented by SAS user Alex Chaplin.

Find more tutorials on the SAS Users YouTube channel.

From The DO Loop
Want more? Visit our blog for more articles like these.
Discussion stats
  • 1 reply
  • 985 views
  • 0 likes
  • 2 in conversation