Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Pasting the data from Excel to Stata converts values of the variable

    Dear Stata Members
    I am dealing with some financial data like income, total assets, etc. Many of them are very big numbers for instance USD 25678998.567. Data is in the xls format and when I copy my variables and paste it in edit mode of Stata, many of those digits (values) are changed. How to preserve the original numbers including the decimal points before inputting data

  • #2
    It might be due to Stata's default single-precision floating point numerical datatype, but you would probably be better off importing the data into Stata programmatically rather than a copy-and-paste approach to data transfer.
    Code:
    help import excel
    for more information about how to do that.

    Comment


    • #3
      Dear Joseph Coveney , that works I think. Yes I shouldnt have pasted data which I often do

      Comment


      • #4
        I have somewhat similar issue, when I copy-paste from Stata to excel, all other data is pasted fine except one row of observation which is pasted in two lines. Why is that so? I cannot upload my data here (data privacy) and I cannot replicate this issue in other data.
        When I copy paste in excel, there is an extra comma I get:

        Click image for larger version

Name:	Screenshot 2021-12-28 at 17.13.47.png
Views:	1
Size:	64.3 KB
ID:	1642567



        Stata data viewer:
        Click image for larger version

Name:	Screenshot 2021-12-28 at 17.35.33.png
Views:	1
Size:	217.0 KB
ID:	1642568


        Here, study 55 is pasted in two lines. There is an extra tab with comma. I will use export excel to resolve this issue, but I am just curious to know what led to this.

        Comment

        Working...
        X