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

st: Saveold degrades variables' formats

From   "Sergiy Radyakin" <[email protected]>
To   "[email protected]" <[email protected]>
Subject   st: Saveold degrades variables' formats
Date   Sun, 17 Aug 2008 21:28:22 -0400

Dear All

Last week on Aug 13, there was a question regarding reading Stata 10
files in Stata 9 in the thread "st: Stata 10 files in Stata 9".
Several answers were given to this question , i.e.:

1) use saveold command in Stata 10 to save a file in Stata 9 format
2) use Stat\Transfer 9 or another conversion program
3) my answer to convert the file by stripping-off extra formatting
bytes and substituting the version signature

I don't know if the person who asked the question has resolved the
issue, but this weekend I had some time to implement just what I have
said. Two things became apparent:
1. this is doable and works just fine.
2. Stata does not convert the dataset correctly with the command
saveold in at least one case as can be illustrated below:

------ Step I (to be performed in Stata 10) --------
input my_date
format my_date %dM-D-Y
saveold R:\saveold

-------- Step II (to be performed in Stata 9) ----------
use r:\saveold
format my_date %dM-D-Y

To those who do not have both versions of Stata or don't want to spend
time actually running the above example, the following happens:
saveold changes the format of the variable my_date from %dM-D-Y to the
simplier format %d for no apparent reason. Note that this format is
valid in both Stata 10 and Stata 9, and (in my understanding) must be

Stata 10 for Windows, Aug 11, 2008
Stata 9.2 for Windows, July 20, 2007


I assume my program use10.ado can be somewhat more useful if it
converted the data preserving all formats, rather then simply
degrading format to a default. So I would be happy to know:

1) is there any motivation to degrade date format as -saveold- does it?

2) what is the exact strategy of -saveold- while converting formats
from Stata10 to Stata9?

3) is it possible to determine in a comprehensive manner if a given
string is a valid format in Stata 9? (e.g. "the first symbol must be
...., if the first symbol is ... then the second must be ...." etc)

If not, what might be a good rule for substituting formats?

Thank you, Sergiy Radyakin
*   For searches and help try:

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