How about this?
data have;
input obs date date11.;
FORMAT DATE DATE9.;
datalines;
1 19/NOV/2019
2 03/JAN/2020
3 07/FEB/2020
;
Option #1
data want;
set have;
where date gt '01jan2020'd;
run;
proc transpose data=want out=want_t;
var date;
run;
Option #2
proc transpose data=have out=want;
where date gt '01jan2020'D;
var date;
format COL1 COL2 COL3 date9.;
run;
You could use the MIN function in a DATA step
Like this:
data want;
set have;
newvariable=min(of var1-var56);
run;
Although I point out that transposing is not necessary in this case, PROC SUMMARY will find minimums from the un-transposed data.
It doesn't seem like transposing the data was helpful. But you can still get what you want in this fashion:
data want;
set have;
array dates {56} var1-var56;
do _n_=1 to 56;
if year(dates{_n_}) = 2020 then earliest = min(earliest, dates{_n_});
end;
run;
This assumes that the date variables really are dates, and not character strings. Looking at your post, I'm suspicious, but you will have to check that and correct it if necessary.
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!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.