- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I am using EG and PROC SQL to pull the YEAR from a Date field.
So I used:
YEAR(Field_Name) AS BID_YEAR
did the same thing for MONTH, however I am getting this error:
NOTE: Invalid argument to function YEAR. Missing values may be generated.
NOTE: Invalid argument to function MONTH. Missing values may be generated.
So, how does this need to be written?
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Your date variable is probably a SAS datetime, and not a SAS date. Try YEAR(DATEPART(field_name)) as BID_YEAR;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
The hash OUTPUT method will overwrite a SAS data set, but not append. That can be costly. Consider voting for Add a HASH object method which would append a hash object to an existing SAS data set
Would enabling PROC SORT to simultaneously output multiple datasets be useful? Then vote for
Allow PROC SORT to output multiple datasets
--------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Yes, it is coming from an access db, and I checked, it is a date field and there are dates in the tbl. I even went back to make sure I was using the correct syntax and I am
MONTH(BD.BID_DATE) AS BID_MONTH
So I am at a loss...
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Your date variable is probably a SAS datetime, and not a SAS date. Try YEAR(DATEPART(field_name)) as BID_YEAR;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
As I was thinking about it, I had to do that for another calculation, so that was the issue! Thank you!!