BookmarkSubscribeRSS Feed
Rsadiq
Calcite | Level 5

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  ;

1 REPLY 1
ballardw
Super User

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

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!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 1673 views
  • 0 likes
  • 2 in conversation