12-13-2015 07:08 PM
i have a data step that groups by site I need to group by date as well. Currently it looks like this
site id. Machine Machine Machine
123. 04nov2015 09:39:12 04nov2015p 09:39:12 23nov2015 09:39:12
i need to only see 11/04/15 one day than on its own row
123. 23nov2015 09:39:12
my code is
data report6 (drop=I n Mac st et dh) ;
retain siteid total machine1 starttime1 endtime1 dur_time1 &allvar. n;
format &mac. $10 &st . &et. Date time.;
set want3(rename =(machine2=Mac starttime2=st endtime2=et durtime2=dh();
by site_id machine1;
Array m(*) &Mac.;
array s(*) &st.;
if first .site Id Or first.machine then
do ; n=0;
do i=1 to &mx;
if last.siteid or last.machine1 then output report6;
thanks for the assistance
12-13-2015 08:09 PM
It looks like a wide to long transpose, there are two common ways - one is with an array and the second is with a transpose.
If you're looking for the latest date you could use the max function to find the maximum date.
Here are two write ups on how to transpose your data.