08-28-2014 02:18 PM
I have a MS Access table with dates and am trying to import into SAS.
(i.e. 10/5/2007 in the MS Access table is imported into SAS as 05OCT2007:00:00:00 but it is still followed by many zeroes);the input mask in the MS Acess Form is 99/99/0000;0 Also, datatype in MS Access is Date/Time
1) How do I:
a) Convert to a SAS date? I tried the datepart function but I think datepart is only for a date/time that has hours and minutes, not hours, minutes and seconds.?
b) Convert it back to mm/dd/yyyy so I can export back out into access without hving the 00:00:00 at the end?
08-28-2014 02:48 PM
The datepart function pulls the date from any valid SAS datetime value, seconds or fractions thereof don't matter.
Considering I've had dates, declared as DATE values, and entered in Access show 00:00:00.00 I'm not sure if your second part is possible.
Depending on how you are moving data to and from Access the engine should take care of the update but if you are putting the data back into the original table expect the 00:00 as that is most likely an Access feature. You may need to investigate date displays in Access to suppress the time component.
09-02-2014 06:09 PM
I got SAS to convert the date/time into just the date.
But, how do I get SAS to convert or format the SAS date back into mm/dd/yyyy format within SAS?
09-02-2014 06:36 PM
Assign the format mmddyy10. to the variable. If possible the best is to use the statement:
format datevariablename mmddyy10.;
in a program that reads the data. Alternatively you may use Proc Datasets, opening either the column view or table view in explorer and clicking on the variable name/field you want to modify.