Statalist The Stata Listserver

[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

RE: st: Importing dates from Excel

From   "b. water" <>
To   <>
Subject   RE: st: Importing dates from Excel
Date   Mon, 8 May 2006 09:18:27 +0000

I can only give you suggestions:

from within Stata, try -foreach- to automate the seven steps as a .do file, once you got this to work, turn it into an .ado file, then all you have to do is to call the .ado to get the job done the next time you need to update.


> Date: Sun, 7 May 2006 08:44:12 -0400
> From:
> To:
> Subject: st: Importing dates from Excel
> Hi,
> I have 7 date columns in my master file in the "float" format and need
> to constantly update the date info in the master file since some obs
> have missing dates. To do this, I create a new using data file with
> the updated dates and then merge into the master file. The problem is
> that the using data file has dates in the "string" format since I
> export dates from Excel in the mm/dd/yyyy format. So, each time I have
> to go through 7 different iterations of the program below to change
> date formats in the using data file so I can merge it correctly in the
> master file in the "float" format.
> For example, assume one of my 7 date variables in the master file is
> called bdate. I then have to use
>  . generate bdate1 = date(bdate, "mdy")
>     . format bdate1 %d
> .rename bdate1 bdate
> change it into a "float" storage type.
> I have to do this for each of the 7 dates everytime I want to update
> missing date info in my master file.
> Is there a faster way? Can I format the dates in Excel in such a way
> that the using data file will import the dates correctly in the
> "float" format? I need the date in the float format because I have to
> calculate no of days between dates. My master file has dates in the
> form "08apr2006", for example.
> Thanks,
> Hugh
> *
> *   For searches and help try:
> *
> *
> *

Enter the Windows Live Mail beta sweepstakes
*   For searches and help try:

© Copyright 1996–2017 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index