BookmarkSubscribeRSS Feed
t34
Obsidian | Level 7 t34
Obsidian | Level 7

Hello,

 

I show you what I want to do. I have to tables: have1 and have2 and I want to have the table "want". If date of have2 is between start_date and end_date I want to copy this field.

Please, can you help me with this?

 

Thanks for your help!!

 

 

data have1;
informat Start_Date End_Date ddmmyy10.;
format Start_Date End_Date ddmmyy10.;
input id  Start_Date  End_Date;
datalines;
10 08/02/2020 07/03/2020
10 02/10/2020 18/10/2020
;;;;
run;
data have2;
infile datalines delimiter=',';
informat Date ddmmyy10.;
format Date  ddmmyy10.;
input id  Date  ;
datalines;
10,01/01/20
10,15/02/20 10,01/04/20 10,05/05/20 10,05/10/20 ;;;;; run; data want; infile datalines delimiter=','; informat Date Start_Date End_Date ddmmyy10.; format Date Start_Date End_Date ddmmyy10.; input id Date Start_Date End_Date; datalines; 10,01/01/20,.,. 10,15/02/20,08/02/2020,07/03/2020 10,01/04/20,.,. 10,05/05/20,.,. 10,05/10/20,02/10/2020,18/10/2020 ;;;; run;
2 REPLIES 2
ballardw
Super User

Your have2 does not have a value of 15/02/20. Is that a typo?

t34
Obsidian | Level 7 t34
Obsidian | Level 7
Yes, It has got it. It´s a typo. thanks

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
  • 512 views
  • 0 likes
  • 2 in conversation