DATA Step, Macro, Functions and more

ERROR: WHERE clause operator requires compatible variables

Reply
Contributor
Posts: 35

ERROR: WHERE clause operator requires compatible variables

hello I have my query below

 

What I'm trying to do is use the asmt_tmplt_id and restrict the data so that it only takes these 4 ids, I get the error below when I try, is it just the wrong type of statement I'm doing?

 

proc sort data=lib.fall_assessments out=tmp3 nodupkey  ;
     where BLD_ASMT_ID in ('461') ;
      by MBR_ID ARC_QUEST_ID RSPN_CHO_ID  ;
   proc sort data=tmp3 nodupkey ;
   where ASMT_TMPLT_ID in ('6746','6953','7086','7173');
      by MBR_ID ARC_QUEST_ID  ;
   proc transpose data=tmp3 out=tmp3 ;
     by MBR_ID  ;
     id ARC_QUEST_ID ;
     var RSPN_CHO_ID ;
   run ;

 

 

NOTE: There were 4468 observations read from the data set LIB.FALL_ASSESSMENTS.
      WHERE BLD_ASMT_ID='461';
NOTE: 106 observations with duplicate key values were deleted.
9                                                          The SAS System                             15:52 Friday, November 3, 2017

NOTE: The data set WORK.TMP3 has 4362 observations and 12 variables.
NOTE: PROCEDURE SORT used (Total process time):
      real time           0.05 seconds
      cpu time            0.03 seconds
     

33            proc sort data=tmp3 nodupkey ;
34            where ASMT_TMPLT_ID in ('6746','6953','7086','7173');
ERROR: WHERE clause operator requires compatible variables.
35               by MBR_ID ARC_QUEST_ID  ;

Super User
Posts: 11,343

Re: ERROR: WHERE clause operator requires compatible variables

Apparently your ID variable is actually numeric and not character. Remove the ' from the IN values.

Ask a Question
Discussion stats
  • 1 reply
  • 141 views
  • 0 likes
  • 2 in conversation