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-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!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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