DATA Step, Macro, Functions and more

Finding the minimum time value among a list of variables

Reply
Frequent Contributor
Posts: 131

Finding the minimum time value among a list of variables

Hi!

 

Would anyone have a suggestion for which function to use to find the earliest time value from an array of variables?

 

I appreciate it!!

Contributor
Posts: 55

Re: Finding the minimum time value among a list of variables

[ Edited ]

Assuming you already have your array, called x

 

data want;
  set have;
  /* array x declaration */;
  do over x;
    min_date = min(of min_date,x);
  end;
/* or whatever date format you're working with */
format min_date mmddyy10.; run;
Regular Contributor
Posts: 212

Re: Finding the minimum time value among a list of variables

[ Edited ]

Hi mate,

 

Try this:

 

data test;
 inv=101;  date2="02FEB1900 19:00"dt; date3="01JAN1890 11:22"DT; date4="09NOV2014 02:22"dt; 
 format date1-date4 datetime.;
run;

data want (drop=i);
 set test;
 array date{*} date:;
   mindate = min(of date{*});
   format mindate datetime20.;
run;

Hope this helps

 

Att

Ask a Question
Discussion stats
  • 2 replies
  • 194 views
  • 0 likes
  • 3 in conversation