Announcement

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

  • #16
    Taking the example given #1 by Vincent La, I have the data for Colombia and I want the same to be same filled for China and all other countries in panel. But I don't want to use "expand" because I want the data to be filled year-wise. Hence, data for Colombia for year 2007 will be same for China for 2007 and all years.

    Comment


    • #17
      From #16 I have the data filled in one country of panel but I want same to be filled for all countries but the data should be filled year-wise. I have the data in panel format.

      Comment


      • #18
        How can China's values be identical to those of Colombia? I am missing your point here. In #15 I asked for a data example as explained in https://www.statalist.org/forums/help#stata and that request still stands.

        Comment


        • #19
          I am using Stata 13.0. I think dataex is not available there. Dataex is available for Stata 15 or above. So, I don't know how to put data example here.
          I am trying to regress US interest rate on all other countries GDP. So, In panel I have added the US interest rate against US GDP and I want the US interest rate to be written beside other countries GDP too.
          I have US on top of list for which US interest rate data is filled, I want it to be US interest rate to be written beside other countries data also to regress.
          Just I want to copy and paste it downward for all countries by years. Like in excel, after sorting the time variable, we select our desired variable and and drop it down to the point, we want it to be copied. I hope it is clear now.
          Thank you.

          Comment


          • #20
            Thanks for the extra detail. But on dataex: as the link given in #18 explains, the code is accessible to you. You just have to install dataex first-- the version on SSC should be good for Stata 9.2 up.

            Without a data example -- using that or any other means -- we're still guessing a bit, but let's imagine that you have a variable called
            us_rate that is populated with values for the United States and missing everywhere else.


            Code:
            bysort year (us_rate) : replace us_rate = us_rate[_n-1] if missing(us_rate) 
            fits that scenario. The sort sorts the non-missing value to position 1 in each block of observations. Then you can copy it downwards in a cascade.

            See also

            https://www.stata.com/support/faqs/d...issing-values/

            https://www.stata-journal.com/articl...article=dm0055

            Comment


            • #21
              Sorry for late reply and thank you for your kind response. Now, I will be able to do that. Thank you.

              Comment


              • #22
                Just for reference, fillmissing (from SSC) has some extra bells and whistles for filling missing values. You may like to read this short blog post on it https://fintechprofessor.com/2019/12...lues-in-stata/
                Regards
                --------------------------------------------------
                Attaullah Shah, PhD.
                Professor of Finance, Institute of Management Sciences Peshawar, Pakistan
                FinTechProfessor.com
                https://asdocx.com
                Check out my asdoc program, which sends outputs to MS Word.
                For more flexibility, consider using asdocx which can send Stata outputs to MS Word, Excel, LaTeX, or HTML.

                Comment

                Working...
                X