Date: Tue, 15 Jan 2008 08:52:23 -0800
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
Subject: Re: Export to Access Date Format
Content-Type: text/plain; charset=ISO-8859-1
On Jan 15, 9:49 am, shellp <coolchic...@sympatico.ca> wrote:
> I imported a flat file to a SAS data set and imported the dates with
> yymmdd8. These dates are now stored as SAS dates.
> I now wish to import the file to Access using:
> PROC EXPORT DATA= MYLIB.NACRS2003
> OUTTABLE= "NACRS2003"
> DBMS=ACCESS REPLACE;
> DATABASE="D:\Data Files\Data Release\NACRSLHIN12.mdb";
> How do I format the dates so that they show up as yyyymmdd?
> Also, is there any way to append data to a table in Access? I have 6
> datasets that I wish to all be copied to the one table.
> Thanks very much.
Hi Shelley; I played around with this and have a few comments; (Better
You can use the format ' yymmdd10. ' to change 08-01-11 to
2008-01-11 (see below)
The SAS format however; if imported as defined using the format above,
would be read in by Access to 01/11/2008 (with Date property).
However; Access would recognize this as a date and apply any formats
that you have
associated to the fiels already (If you're appending to a table that
is pre-defined via an import spec), if it is a new table
you are creating simply format it as desired in Access.
To force the format you want, you can change it to text in SAS... then
Access will read it in as '2008-01-11' however; Access will not
recognize it as a date... it will be assigned a text propery which you
can then with some simple Access translation logic change to a date
property. (Again this assumes a new table).
input Date : yymmdd8. ;
format Date yymmdd10.;
data yy(drop=_d); set xx(rename=(date=_d));
PROC EXPORT DATA= yy
DATABASE="C:\Documents and Settings\jamesgr\Desktop
Where appending is concerned, this has been discussed in the newsgroup
I'll keep digging tho as I would also like to know an easy way using
proc export to append to a table.
What version of SAS are you running? What version of Access?