Hi,
I am working on on SQL Server Database, with a low date as 0001-01-01, While reading this data into SAS these values are shown a nulls or ***** can any one of you please help on this. One millions thanks well in advance.
WIth regards
Ramana Potluri
*** usually because length of format is too short, try assign a longer format Like format date date9. Or remove that format and see what is going on in it . proc print ; format date;
I have already tried this. This did not work.
My problem here any date prior to 1958-01-01 is reading as missing. How can I resolve this.
Maybe you could import these date into SAS as character (at SQL Server side) and transform it into data by INPUT() .
What is the column type in SQL Server? Datetime or something else? How are you reading SQL Server? SAS/ACCESS to SQL Server or ODBC?
@VRPotluri wrote:
I have already tried this. This did not work.
My problem here any date prior to 1958-01-01 is reading as missing. How can I resolve this.
That would be very strange, as SAS accepts dates back to the 16th century:
dateval = input(datestring,yymmdd10.);
format dateval yymmddd10.;
cards;
1960-01-01
1958-01-01
1850-01-01
1750-01-01
1690-01-01
1590-01-01
;
run;
proc print;
run;
Result:
Obs datestring dateval 1 1960-01-01 1960-01-01 2 1958-01-01 1958-01-01 3 1850-01-01 1850-01-01 4 1750-01-01 1750-01-01 5 1690-01-01 1690-01-01 6 1590-01-01 1590-01-01
Since I doubt that you have any actual values recorded for 0001-01-01 I suspect that exact value is being used as either a place holder or indicator for missing or invalid data. Due to vagaries of history and inconsistent calendars SAS does not support dates prior to the English adoption of the Gregorian calendar.
Also if you are looking at OUTPUT in Excel by any chance, Excel doesn't support dates prior to 1900.
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.