BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
goliPSU
Calcite | Level 5

below is the part of my code:

proc iml

%let yr = '1993';

nonMakeInd = {192}; /*Identify empty rows of the Make matrix*/

use CxC_ind;

read all var {FMB_IO} into CxC;

num_com = nrow(CxC);

print num_com;

/*-----------------------------------------------------------------------------*/

/*-----------------------------------------------------------------------------*/

/*DEFINE, LOCATE matrix positions of sets and subsets */

use Zcom;

read all var {FMBCOM} into sector_list where (stat_year = &yr);

num_sectors = nrow(SECTOR_LIST);

print num_sectors;

I have the data Zcom where it has column field called : "STAT_YEAR" I am trying to extract part of the data where STAT_YEAR = '1993'

But I see the following error in the log:

285  use Zcom;

286  read all var {FMBCOM} into sector_list where (stat_year = &yr);

ERROR: Type mismatch in WHERE clause for variable stat_year.

statement : READ at line 286 column 1

287  num_sectors = nrow(SECTOR_LIST);

288  print num_sectors;

Could not display help because connection to the remote browser failed.

Any Idea:

1 ACCEPTED SOLUTION

Accepted Solutions
Rick_SAS
SAS Super FREQ

The SAS/IML User's guide is online, so you can view it whenever you have an internet connection.

http://support.sas.com/documentation/onlinedoc/iml/index.html#iml93

The WHERE clause is discussed in several places, including here: http://support.sas.com/documentation/cdl/en/imlug/64248/HTML/default/viewer.htm#imlug_worksasdataset...

Your error is that you defined &yr to be a character value when you wrote

%let yr = '1993';

If stat_yrear is a numerical variable, this is a "type mismatch" because you are trying to match a numerical value to a character string.

Use

%let yr = 1993;

View solution in original post

2 REPLIES 2
Rick_SAS
SAS Super FREQ

The SAS/IML User's guide is online, so you can view it whenever you have an internet connection.

http://support.sas.com/documentation/onlinedoc/iml/index.html#iml93

The WHERE clause is discussed in several places, including here: http://support.sas.com/documentation/cdl/en/imlug/64248/HTML/default/viewer.htm#imlug_worksasdataset...

Your error is that you defined &yr to be a character value when you wrote

%let yr = '1993';

If stat_yrear is a numerical variable, this is a "type mismatch" because you are trying to match a numerical value to a character string.

Use

%let yr = 1993;

goliPSU
Calcite | Level 5

Thank you, it was very helpful.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

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
  • 2 replies
  • 1609 views
  • 0 likes
  • 2 in conversation