Announcement

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

  • Looking for syntax help with user written INFLATE program

    Hi all, I'm fairly new to STATA and am trying to use the user written program "inflate" to convert approximately 50 variables of unadjusted finance data into 2019 dollars using CPI. My data begins in 1982. I've read the inflate help file in STATA but am having issues getting the syntax of how to tell STATA to adjust 50 variables at once. There are about 10 variables in the dataset which I do not want adjusted so it is not the entire dataset.

    Does anyone have experience using inflate to adjust multiple variables (but not an entire dataset) at a time who would be willing to share what the syntax of your code is? I know I could manually type each variable name separated by commas but I figure there might be a cleaner/less time consuming way to do this.

    Please forgive me if this is not an appropriate question for the forum. Grateful for any advice, thank you in advance for your time and consideration.

  • #2
    If you want everything except variables a b c then

    Code:
    ds a b c, not
    leaves the complement in r(varlist). So, at worst you need to type about 10 names.

    Here is a silly example:

    Code:
    . sysuse auto, clear
    (1978 automobile data)
    
    . ds make, not
    price         rep78         trunk         length        displacement  foreign
    mpg           headroom      weight        turn          gear_ratio
    
    . su `r(varlist)'
    
        Variable |        Obs        Mean    Std. dev.       Min        Max
    -------------+---------------------------------------------------------
           price |         74    6165.257    2949.496       3291      15906
             mpg |         74     21.2973    5.785503         12         41
           rep78 |         69    3.405797    .9899323          1          5
        headroom |         74    2.993243    .8459948        1.5          5
           trunk |         74    13.75676    4.277404          5         23
    -------------+---------------------------------------------------------
          weight |         74    3019.459    777.1936       1760       4840
          length |         74    187.9324    22.26634        142        233
            turn |         74    39.64865    4.399354         31         51
    displacement |         74    197.2973    91.83722         79        425
      gear_ratio |         74    3.014865    .4562871       2.19       3.89
    -------------+---------------------------------------------------------
         foreign |         74    .2972973    .4601885          0          1

    Comment


    • #3
      back with another question - I figured out my syntax for the program but when I run the line of code (shown below) I get the following error:


      I'm using STATA16. I tried to find the temporary file and rename any files beginning with __ but am still getting the error after trying to troubleshoot that.


      Comment


      • #4
        #3 looks incomplete to me.

        Comment


        • #5
          It looks like the picture didn't attach properly, my apologies! I've typed out the syntax below

          When I run this line of code: inflate $finance, start (1982) end (2019)

          I get this message: Importing CPI from FRED API to C:\Users\coan.17\ado\plus//i//cpi.dta

          And then this error: file __000000.txt could not be opened
          file with temporary name already exits

          rename files that begin with __ r(498); end of do-file r(498);


          I've tried going into that file and renaming files that begin with ___ but it has not solved the problem.

          Comment


          • #6
            Two underscores, not three?

            Comment


            • #7
              yes I removed all files with 2 underscores earlier this week and that didn't solve the problem, yesterday I removed all single "_" from file names as well but that didn't solve the problem either

              Comment

              Working...
              X