[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
RE: st: Importing dates from Excel
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: firstname.lastname@example.org
> To: email@example.com
> Subject: st: Importing dates from Excel
> 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
> ............to 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.
> * For searches and help try:
> * http://www.stata.com/support/faqs/res/findit.html
> * http://www.stata.com/support/statalist/faq
> * http://www.ats.ucla.edu/stat/stata/
Enter the Windows Live Mail beta sweepstakes
* For searches and help try: