Announcement

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

  • Explaining 1 line of codes

    Hi,

    I have advanced stata codes that i am trying to build on in order to generate results. However, since I am a beginner in stata, I wasn't able to interpret the line in order to change the variables according to my needs. I would be very very grateful if someone explains this line to me (and please bear my ignorance):

    Code:
    model_dy reg L(0/`lag').dl_`cat'_rloans L(1/`lag').epu_`epu' L(1/`lag').dy L(1/`lag').dr L(1/`lag').RegQ L(1/`lag').credit_controls L(1/`lag').cexp i.quarter
    The variables that I have in the dataset are :
    name
    q_date
    dl_tot_rloans
    dl_cai_rloans
    dl_rea_rloans
    dl_con_rloans
    dr
    dy
    credit_controls
    RegQ
    epu_hist_new
    epu_finc
    epu_headline
    cexp
    quarter
    jgdp
    So mainly I don't undertstand the following:
    1.L(0/`lag') and L(0/`lag')
    2.the dot represents what ? for example in L(1/`lag').epu. is this the one period lagged value of epu? if this is the case then i.quarter is what ?
    3.L(0/`lag').dl_`cat' is what? (I don't have any cat variable)
    4. Finally,in L(1/`lag').epu_`epu' why is there two consecutive epu? (in other words what i the job of _`epu')?

    Many thanks
    Last edited by wesso dadoyan; 17 Apr 2017, 02:44. Reason: English typo

  • #2
    OK, first you're more likely to get a helpful response if you follow the FAQ on asking questions - Stata code in code delimiters, Stata output, and sample data using dataex. Also simplify things as far as possible while still replicating your problem.

    First, you need to read the documentation on macros and lags. You clearly don't understand them.

    Try running this with "set trace on". This will tell you how Stata is interpreting your code (and particularly your macros). You might also list your macros (macro list) to see what has been created. I don't know what model_dy means.
    Anything `x' with those marks on either side is a local macro. So `x' refers to a local macro x. That just holds whatever text or number has been placed in that macro. It doesn't refer to a variable per se (although it might hold the name of a variable you want to use).
    1. L(1/2).x means you include one and two lags of x.
    2. the dot connects a lag operator to the variable it operates on
    3. `cat' refers to a local macro called cat. In this context it means you have a variable dl_`cat' that starts dl_ and ends with whatever is in `cat'.
    4. Likewise, epu_`epu' refers to a variable called epu_ followed by whatever is in the local macro epu.

    Comment

    Working...
    X