Hi All,
I am using Stata 13. I have a numeric birth date variable that Stata is reading as string (type str10 format %10s). I am importing the data set from excel. I have tried the destring command and Stata returns this message "chd_b_date contains nonnumeric characters; no replace". This is an example of how birth date is inputed in my data set 12/31/2002. I have another data set that I import into Stata and the same birth date variable is read as "int" for type and "%tdnn/dd/CCYY" for format. How can I change the birth date variable that is being read as string to this type "int" and this format "%tdnn/dd/CCYY".
I looked at this forum http://www.statalist.org/forums/foru...e-output/page2 and a PDF from the Stata Journal "Cleaning up user entered string variables". Those resources had me try to delete blank spaces in cells but nothing has worked so far. I used
and the new variable also cannot be changed to numeric.
I tried this code to see if I can identify which cells are causing problems
. Stata listed all the observations again this is an example of how birth date is entered 11/14/2006.
Any comments or support that you can share will be much appreciated!
Thank you
Patrick
I am using Stata 13. I have a numeric birth date variable that Stata is reading as string (type str10 format %10s). I am importing the data set from excel. I have tried the destring command and Stata returns this message "chd_b_date contains nonnumeric characters; no replace". This is an example of how birth date is inputed in my data set 12/31/2002. I have another data set that I import into Stata and the same birth date variable is read as "int" for type and "%tdnn/dd/CCYY" for format. How can I change the birth date variable that is being read as string to this type "int" and this format "%tdnn/dd/CCYY".
I looked at this forum http://www.statalist.org/forums/foru...e-output/page2 and a PDF from the Stata Journal "Cleaning up user entered string variables". Those resources had me try to delete blank spaces in cells but nothing has worked so far. I used
Code:
gen chd_b_date1=trim(chd_b_date)
I tried this code to see if I can identify which cells are causing problems
Code:
list chd_b_date if missing(real(chd_b_date))
Any comments or support that you can share will be much appreciated!
Thank you
Patrick
Comment