Hello, I am trying to figure out this issue with date format. I have a dataset that has 3 dates: admit dob discharge but at some point the dates in the format of a double %tdnn/dd/CCYY turns into scientific notation in the middle of the variable like such:
+------------------------------------+
| admit dob discharge |
|------------------------------------|
62756. | 2/28/2022 6/17/1988 3/3/2022 |
62757. | 2/28/2022 7/22/1967 3/4/2022 |
62758. | 1.962e+12 1.224e+12 1.962e+12 |
62759. | 1.962e+12 1.329e+12 1.967e+12 |
62760. | 1.962e+12 -4.998e+11 1.962e+12 |
|------------------------------------|
62761. | 1.962e+12 1.873e+12 1.962e+12 |
62762. | 1.962e+12 9.779e+11 1.983e+12 |
62763. | 1.962e+12 -1.531e+11 1.962e+12 |
62764. | 1.962e+12 4.549e+11 1.962e+12 |
+------------------------------------+
I noticed that when I use the command "gen dateofbirth = dob" I get this:
+------------------------------------------------+
| admit dob discharge dateofb~h |
|------------------------------------------------|
62756. | 2/28/2022 6/17/1988 3/3/2022 10395 |
62757. | 2/28/2022 7/22/1967 3/4/2022 2759 |
62758. | 1.962e+12 1.224e+12 1.962e+12 1.22e+12 |
62759. | 1.962e+12 1.329e+12 1.967e+12 1.33e+12 |
62760. | 1.962e+12 -4.998e+11 1.962e+12 -5.00e+11 |
|------------------------------------------------|
62761. | 1.962e+12 1.873e+12 1.962e+12 1.87e+12 |
62762. | 1.962e+12 9.779e+11 1.983e+12 9.78e+11 |
62763. | 1.962e+12 -1.531e+11 1.962e+12 -1.53e+11 |
62764. | 1.962e+12 4.549e+11 1.962e+12 4.55e+11 |
+------------------------------------------------+
If that helps.
I am hoping to just have one legible date for the data in question and any time I try to format the variable it reverts everything to the original date in 1960 for stata default state except for the ones in scientific notation ones that convert... somewhat well but they are off by a margin that will not work for accuracy
+------------------------------------+
| admit dob discharge |
|------------------------------------|
62756. | 2/28/2022 6/17/1988 3/3/2022 |
62757. | 2/28/2022 7/22/1967 3/4/2022 |
62758. | 1.962e+12 1.224e+12 1.962e+12 |
62759. | 1.962e+12 1.329e+12 1.967e+12 |
62760. | 1.962e+12 -4.998e+11 1.962e+12 |
|------------------------------------|
62761. | 1.962e+12 1.873e+12 1.962e+12 |
62762. | 1.962e+12 9.779e+11 1.983e+12 |
62763. | 1.962e+12 -1.531e+11 1.962e+12 |
62764. | 1.962e+12 4.549e+11 1.962e+12 |
+------------------------------------+
I noticed that when I use the command "gen dateofbirth = dob" I get this:
+------------------------------------------------+
| admit dob discharge dateofb~h |
|------------------------------------------------|
62756. | 2/28/2022 6/17/1988 3/3/2022 10395 |
62757. | 2/28/2022 7/22/1967 3/4/2022 2759 |
62758. | 1.962e+12 1.224e+12 1.962e+12 1.22e+12 |
62759. | 1.962e+12 1.329e+12 1.967e+12 1.33e+12 |
62760. | 1.962e+12 -4.998e+11 1.962e+12 -5.00e+11 |
|------------------------------------------------|
62761. | 1.962e+12 1.873e+12 1.962e+12 1.87e+12 |
62762. | 1.962e+12 9.779e+11 1.983e+12 9.78e+11 |
62763. | 1.962e+12 -1.531e+11 1.962e+12 -1.53e+11 |
62764. | 1.962e+12 4.549e+11 1.962e+12 4.55e+11 |
+------------------------------------------------+
If that helps.
I am hoping to just have one legible date for the data in question and any time I try to format the variable it reverts everything to the original date in 1960 for stata default state except for the ones in scientific notation ones that convert... somewhat well but they are off by a margin that will not work for accuracy
Comment