Currently I have a field that contains datetime called image_date.
However, I only want the month and year. This is what I have done.
PROC SQL;
CREATE table test as
SELECT store_code, datepart(image_date) as image_date format=$MONYY7., cnt
FROM &image_store.
;
quit;
Of course the problem is that even though I see month and year in the table, it is actually still stored in numeric format by sas. What I want to be able to do is do a group by on the image date (by month). But what is happening is it is grouping it by day since the datepart() really did not do anything to the actual date. Is there any solution out there in which I can just extract the month and year from the datetime and then be able to group that field by month?
Please let me know if furhter clarificatio is needed.
Thanks
However, I only want the month and year. This is what I have done.
PROC SQL;
CREATE table test as
SELECT store_code, datepart(image_date) as image_date format=$MONYY7., cnt
FROM &image_store.
;
quit;
Of course the problem is that even though I see month and year in the table, it is actually still stored in numeric format by sas. What I want to be able to do is do a group by on the image date (by month). But what is happening is it is grouping it by day since the datepart() really did not do anything to the actual date. Is there any solution out there in which I can just extract the month and year from the datetime and then be able to group that field by month?
Please let me know if furhter clarificatio is needed.
Thanks