Announcement

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

  • Wrong number of observations

    Hi, I’m using Stata for a time series analysis. However, a problem occurs when I import my data from excel.
    I have about 150 observations in my data set. However, after importing from excel, Stata shows there are only 21 observations. I also tried copy and paste but the problem still occurs. All data are numerical variables. I don't know what is wrong with the data set. Is there any problem with excel when importing?
    Please see the attached photos for reference.
    Click image for larger version

Name:	74280C00-3BAB-4B1F-8FEA-9632E4A2A862.png
Views:	1
Size:	79.0 KB
ID:	1667896
    Click image for larger version

Name:	C54631BD-8501-4B3B-8DB1-037F10EA9813.png
Views:	1
Size:	16.5 KB
ID:	1667897

  • #2
    I occasionally encounter problems like this if there were blank rows following the last row that was successfully imported. Sometimes it is hard for Stata to figure out what the data area on a worksheet is if it is not entirely contiguous. If this is your problem, go back into the Excel worksheet and find the row and column of the last cell that should be imported. Then use the -cellrange()- option in your -import excel- command to tell Stata the full extent of the data area. (Actually, even if you don't see any breaks in the data area on the spreadsheet, this is worth a try and might work anyway.)

    If that does not solve the problem, I'm afraid I don't know what to suggest. Your spreadsheet might be corrupted in some way. Perhaps using Excel to export it to .csv and then using -import delimited- might work. Or perhaps somebody else on the Forum has ideas?

    Comment


    • #3
      Thank you Clyde for you answer. I think I misunderstood the concept of observations. Apparently, it is the number of years in the data set (if I understand correctly). My data is from 2000 to 2020, so, 21 observations should be correct.
      Put the above problem aside, I fail to conduct the dicky-fuller test. The command I used is simply: dfuller x, lag() regress. The result is incomplete (std err, t value, p value, and confidence interval are all missing values). Number of observations is 8 this time, which I think is the main reason Stata is unable to calculate the result. Why is Stata omitting so many values? Considering I only have 21 years in my data set, is the observation so small for Stata to do the dicky-fuller test?
      Any help is appreciated.

      Comment


      • #4
        As used in Stata parlance, "observations" refers to the number of "rows" in your data set. So we were talking past each other from the start!

        As for the -dfuller- command and the Dickey-Fuller test, I'm afraid I know nothing about it. Hopefully, somebody else will jump in and answer your question. If that doesn't happen in a timely manner, I suggest you repost in a new thread, and mention -dfuller- in the title so your post will attract people who can help with that command. Also, showing the complete output you are getting from -dfuller- there will probably be helpful.
        Last edited by Clyde Schechter; 05 Jun 2022, 21:48.

        Comment


        • #5
          Thank you again Clyde for clarifications and suggestions. Much appreciated.

          Comment

          Working...
          X