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?
Thanks!
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.
Thanks!!
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?
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.
Thank you! I was trying to use an array and the input or put statement and that did not work!
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: