BookmarkSubscribeRSS Feed
PaigeMiller
Diamond | Level 26

@Pandu2 wrote:
data have;

input id term project sasdate date1

cards;

1 10 197 01may2022 07feb2022

1 10 197 09apr2022
12mar2022

1 10 197 30apr2022
15apr2022

1 10 201 31mar2022
29mar2022

1 10 201 17feb2022
11jan2022

;
This is the data I've and what I require is sas_date should be greater than date1 and the sas_date should be the earliest date. Once the condition meets that row should be picked by grouping id term project.
Output table should be like :

1 10 197 09apr2022
12mar2022


1 10 201 17feb2022
11jan2022

;
I hope you got me.

I still don't see you walking us through, step-by-step, how you arrive at the desired output (which I have previously requested). So I don't understand.

--
Paige Miller
Pandu2
Obsidian | Level 7
I apologise, I tried my best to walk you through this. Even if you still don't understand, can you atleast help me on comparing two sas date variables which are in date9 format. Thankyou.
The comparison should be like sas_date >= date1

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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
  • 16 replies
  • 1382 views
  • 0 likes
  • 3 in conversation