BookmarkSubscribeRSS Feed
Maisha_Huq
Quartz | Level 8

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!!

2 REPLIES 2
JoshB
Quartz | Level 8

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;
DartRodrigo
Lapis Lazuli | Level 10

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

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

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