OR does not work I need both conditions patient id and visit date. Thank you.
The idea of OR was to see if there are records actually present in your data
@Dhana18 wrote:
I used this datastep
DATA SUBMTWO.Clinicdata29_1;
SET SUBMTWO.Clinicdata29;
IF CL_PATIENTID='50055' then flag1=1;
if visdate='11/27/2017' then flag2=1;
RUN;
then used this proc print statement, and this is the output
Obs VISDATE CL_PATIENTID83910851203
2017/10/17 50055 2017/11/27 50055 2017/12/11 50055
Show the full log (including the proc print) and include the flags in the PROC PRINT. Without them, you can't see where the issue is coming from.
DATA SUBMTWO.Clinicdata29_1;
SET SUBMTWO.Clinicdata29;
IF CL_PATIENTID='50055' then flag1=1;
if visdate='11/27/2017' then flag2=1;
RUN;
12 DATA SUBMTWO.Clinicdata29_1;
13 SET SUBMTWO.Clinicdata29;
14 IF CL_PATIENTID='50055' then flag1=1;
15 if visdate='11/27/2017' then flag2=1;
16 RUN;
NOTE: There were 3414 observations read from the data set SUBMTWO.CLINICDATA29.
NOTE: The data set SUBMTWO.CLINICDATA29_1 has 3414 observations and 59 variables.
NOTE: DATA statement used (Total process time):
real time 0.10 seconds
cpu time 0.00 seconds
proc print data=SUBMTWO.Clinicdata29_1 ;
var flag1 flag2 CL_patientid toc_vis;
where cl_patientid="50055";
run;
25 proc print data=SUBMTWO.Clinicdata29_1 ;
26 var flag1 flag2 CL_patientid toc_vis;
27 where cl_patientid="50055";
28 run;
NOTE: There were 3 observations read from the data set SUBMTWO.CLINICDATA29_1.
WHERE cl_patientid='50055';
NOTE: PROCEDURE PRINT used (Total process time):
real time 0.03 seconds
cpu time 0.01 seconds
@Dhana18 wrote:
I used this datastep
DATA SUBMTWO.Clinicdata29_1;
SET SUBMTWO.Clinicdata29;
IF CL_PATIENTID='50055' then flag1=1;
if visdate='11/27/2017' then flag2=1;
RUN;
then used this proc print statement, and this is the output
Obs VISDATE CL_PATIENTID83910851203
2017/10/17 50055 2017/11/27 50055 2017/12/11 50055
Which shows no value of 11/27/2017 for the VISDATE variable. If that is character variable then you want to specify '2017/11/27' if you want to set that variable for the middle row.
Thank you for your persistent support.
I used this
DATA SUBMTWO.Clinicdata29_1;
SET SUBMTWO.Clinicdata29;
if VISDATE='2017/11/27' AND CL_PATIENTID='50055' then TOC_VIS="1";
RUN;
and worked. yay! I needed to put the date "201/11/27".
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.
Ready to level-up your skills? Choose your own adventure.