Announcement

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

  • Denton command and time variables

    Hello everyone,

    I currently try to interpolate a gdp series with the command "denton", with the Industrial Prodution Index ("ipi") as indicator variable.

    I first created a .dta files where I defined the ipi as a times serie :

    I copy-pasted the data from my excel files and coded :

    HTML Code:
    generate t=tm(1999m1)+ _n -1
    format t%tm 
    tsset t
    I just coded that and saved the .dta files

    I then created another .dta files with the gdp variable :

    HTML Code:
    generate t=tq(1999q1)+ _n -1
    format t%tq 
    tsset t 
    and specified the directory

    HTML Code:
    cd "C:\User..."
    I thought it was enough to use the denton command :

    HTML Code:
    denton gdp using gdpdat.dta, interp(ipi) from (ipi.dta) generate(gdpinterp)
    But I had an error message :

    HTML Code:
    variable t already defined
    And I don't understand why.

    Does someone understnd where I made a mistake and how to solve it ?

    Sincerely,

  • #2
    Welcome to Statalist.

    The denton command (a user-written extension to Stata downloaded from SSC, as the Statalist FAQ requests you to mention) merges the two datasets, and both contain the variable t. I think if you give the variables you name t a different name in one of the datasets, you will not get the error message.

    Comment


    • #3
      Thank you a lot William Lisowski ! It worked

      Comment


      • #4
        Hello everyone,
        I am trying to do a similar exercise and I have STATA 15 . I am facing a different problem on running denton command.

        I ran the command as follows and the error is also shown below by "set trace" command:

        denton gdpatmarketprices using ("C:\Users\hkarun\Desktop/test.dta") if tin(2011m1,2017m12), interp(iip) from ("C:\Users\hkarun\Desktop/test.dta") generate(mgdp_iip)
        ---------------------------------------------------------------------------------------------------
        > ------------------------------------------------------------- begin denton ----------------------
        - version 11.1
        - syntax varname(numeric ts) using/ [if] [in], INTerp(string) from(string) GENerate(string) [stock
        > old]
        invalid '"C:\Users\hkarun\Desktop/test.dta'
        ---------------------------------------------------------------------------------------------------
        > --------------------------------------------------------------- end denton ----------------------
        r(198);


        Basically, it did not read my .dta files and I cannot find the reason why it is the case.
        So, I defined the current working directory and wrote the following command:

        denton gdpatmarketprices using test.dta, interp(iip) from (indexes.dta) gen(mgdp)

        Now the error is:
        test.dta is an existing file.
        r(602);


        Can someone please help me understand the error I am committing here?

        Thanks
        Last edited by honeykarun; 04 Sep 2018, 07:36.

        Comment


        • #5
          Hello everyone, #2
          I have an error while converting annual GDP series into quarterly. Please help if anyone have idea about the error.

          I'm trying to interpolate a GDP series with the command "denton" with the Consumer Price Index ("cpi") as indicator variable.
          I first created a .dta files where I defined the cpi as a time series :

          I copy-pasted the data from my excel files and coded :

          [HTML code]

          gen qdate= tq(1992q1)+ _n-1
          format qdate %tq
          tsset qdate




          I just coded that and saved the .dta files.

          then I created another .dta files with gdp variable:

          HTML Code:

          encode Year, generate(year)
          format year %ty
          tsset year


          and specified the directory

          HTML Code:

          cd "E:\Nadia Mahtab\...."


          after changing directory to both .dta files (already saved by using the above code) I'm using denton command as:

          HTML Code:

          denton BGD using new_qgdp.dta, interp(cpi_bgd) from (cpi.dta) gen(qgdp_bgd)


          But I had an error message :

          HTML Code:

          invalid syntax
          r(198);


          I'm unable to understand where I made a mistake and how to solve it?



          Regards,
          Last edited by Nadia Mahtab; 19 Aug 2021, 15:28.

          Comment

          Working...
          X