10-15-2013 12:59 PM
I'm trying to pull data from an ODBC connection (SQL Server), and whenever I pull a date variable, it's coming into SAS as character rather than as numeric. Here's the code I'm using:
CONNECT TO ODBC(DSN='SQL Server');
CREATE TABLE demogs AS
FROM CONNECTION TO ODBC
convert(date,birthdate) as birthdate
The birthdate field comes into SAS as a character variable (e.g., "1986-10-08"). How can I get the imported character date value to be numeric? The reason the "convert" statement is used in the SQL code is that the original date value is in DATETIME, but there is NO time on any of the date values. Thus, I'd prefer to just pull in the month, day, and year and drop the time element (which is always 00:00:00:000) altogether.
I'm sure this is probably a common enough problem, but after searching through the forums (and elsewhere online), I wasn't able to find an issue that touched on this specific ODBC connection problem.
Any help would be greatly appreciated. Thanks!
Need further help from the community? Please ask a new question.