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.

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

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