BookmarkSubscribeRSS Feed
gloriarhyne
Calcite | Level 5

Hi,

 

 I am working in a previously made SAS code that integrates redcap datasets. 

 

I am trying to filter out a certain answer (essentially trying to filter out variables of people who had completed the full timeline of a study vs all others who did not for various reasons for a report) to make it easier when it auto regerates into an Excel spreadsheet for a report. 

 

I've tried doing some simple WHERE commands, some IF commands, etc. (like "WHERE endstatus=0 endreason=0"; run; and changing it to "WHERE endstatus=1,2,3,4 endreason=1,2,3,4"; run;) but it keeps bringing up the variables of "0" which is the complete variable. 

 

Any ideas? Thanks in advance. 

2 REPLIES 2
Reeza
Super User
Your syntax is incorrect - the log should be telling you that as well?
Something like this may work instead:

WHERE endstatus in (1,2,3,4) and endreason in (1,2,3,4);
AMSAS
SAS Super FREQ

Go read the WHERE statement documentation, there are several examples that will help explain the syntax

sas-innovate-wordmark-2025-midnight.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


Register now!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 741 views
  • 0 likes
  • 3 in conversation