BookmarkSubscribeRSS Feed
Vijay77
Fluorite | Level 6

Hi,

   i have two date variables asdtc and estdtc i want to get max(estdtc) when estdtc<=astdtc by subect ? any help would be appreciated

 

i have tried following

 

proc sql;

CASE WHEN substr(ESTDTC,1,10)<=ASTDTC THEN MAX(ESTDTC) group by subbjid; quit;

but it giving values of max(estdtc) by subject not based on estdtc<=astdtc

 

subjid                                     estdtc          astdtc

2008                       2019-03-31T06:50   2019-04-02
2008                      2019-03-28T19:02    2019-04-02
2008                     2019-03-27T19:34    2019-04-02

1 REPLY 1
PeterClemmensen
Tourmaline | Level 20

Can you post some sample of your data? Makes it much easier to provide a usable code answer.

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 261 views
  • 0 likes
  • 2 in conversation