I currently have some data that is in a date format but the underlying information is actually still a SAS date number. Consequently when I come to count on this field I get a separate row for each of the SAS numbers and the information is not grouped on month as I want it to be.
The data I have looks like this;
data beforehave;
input ID $ Activity $ Origianl_Start_Date;
datalines;
12345 Activity1 Oct-13
12345 Activity1 Oct-13
12345 Activity1 Nov-16
12345 Activity2 Nov-16
12345 Activity2 Nov-16
23145 Activity1 Sep-15
23145 Activity2 Sep-15
23145 Activity2 Sep-15
;
RUN;
However when it comes to count permutations on the 'Original_Start_Date' category I get this
data beforehave;
input ID $ Activity $ Origianl_Start_Date Count_of_Original_Start_Date;
datalines;
12345 Activity1 Oct-13 1
12345 Activity1 Oct-13 1
12345 Activity1 Nov-16 1
12345 Activity2 Nov-16 1
12345 Activity2 Nov-16 1
23145 Activity1 Sep-15 1
23145 Activity2 Sep-15 1
23145 Activity2 Sep-15 1
;
RUN;
However what I want is this.
data beforehave;
input ID $ Activity $ Origianl_Start_Date Count_of_Original_Start_Date;
datalines;
12345 Activity1 Oct-13 2
12345 Activity1 Nov-16 1
12345 Activity2 Nov-16 2
23145 Activity1 Sep-15 1
23145 Activity2 Sep-15 2
;
RUN;
I had thought about taking this and turning it into a character format however it would be really useful to keep it as a date.
All I really want is to be able to group a SAS date number based upon the month.
freqandmeanswill automatically group by the formatted values, however a data step will use the underlying value (unless you use thegroupformatoption in abystatement. - Longfish