Help using Base SAS procedures

Having trouble with SAS Proc SQL grouping by date

Reply
New Contributor
Posts: 2

Having trouble with SAS Proc SQL grouping by date

I seem to be having trouble using the group by with Proc SQL e.g
in SQL if i wanted to take a datetime and group by day rather then the full datetime I would do:

CONVERT(varchar(10), DateTime, 101)

When I format to DateTime9.0 in SAS and then try to group by that same column it shows it as DateTime9.0 but won't group by the same.
Super Contributor
Posts: 359

Re: Having trouble with SAS Proc SQL grouping by date

If I understand you correctly take the date from the datetime by
datevar = datepart(datetimevar)
and group by that.
New Contributor
Posts: 2

Re: Having trouble with SAS Proc SQL grouping by date

Thank you.
I just had the datepart in Select Statement and then referenced the alias in the group by
Ask a Question
Discussion stats
  • 2 replies
  • 126 views
  • 0 likes
  • 2 in conversation