Hi there,
I am trying to pull in data from a REDCap database, but I only want data from one dataset to create a dashboard. Unfortunately, I keep having trouble.
Here is my code so far:
Setting the library
***;
libname enroll "X:\SPH\Restricted\Winthrop\Current Projects\Biobank OCTRI\SAS";
data pulmcon (keep=id enrolldate birhdate sex hispanic race currentinsurance smoke height heightmeas currentweight currentweightmeas immuneany_enr copd bronch asthma cf othername inhaleenroll_enr pftdate1 fvcraw fvcdate1 fev1raw1 fev1date1 ratiodate1);
set redcap;
where newntm = 'pulmonary control';
run;
proc print;
The data I want is the pulmonary control data from newntm.
What am I doing wrong?
Thank you in advance.
ERROR: WHERE clause operator requires compatible variables.
So variable newntm must be numeric, and you cannot compare its value to a character string.
where newntm = 'pulmonary control';
The capitalization and spelling and spaces between the words must match exactly, or you won't get the right records.
By the way, you have not explained what you see that indicates you are getting the wrong results. Please tell us what you see that is wrong, and what you expect. That will help us get to the right answer quickly.
ERROR: WHERE clause operator requires compatible variables.
So variable newntm must be numeric, and you cannot compare its value to a character string.
Nearly 200 sessions are now available on demand with the SAS Innovate Digital Pass.
Explore Now →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.