Announcement

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

  • ado file question

    Dear All,

    quick question I'm wanting to make an ado file with multiple categorical variables able to be entered, it may be 3 it may be 4 etc etc

    I can get the code to work when I type it in individually into my long code e.g

    local vars blue black green yellow

    but when I do the ado final it fails

    program define code
    args r(varlist) y z
    tempfile statistics
    postfile ests str1 sex N Median p25 p75
    local vars "`r(varlist)'"

    ....
    then attempt

    code r(blue black green yellow) sex continuous

    what should I be using instead of r(varlist)? so that I can enter blue black green yellow

    Thanks

  • #2
    I don't get a sense that you need a program here. You evidently want to wire in specific variable names. Use a do-file for that purpose.

    Even if you have some variable names left over from something else, syntax accommodating it would be different. A program can start

    Code:
    program code 
            syntax varlist 
    and you might call it with

    Code:
    code `r(varlist)'
    but Stata won't evaluate bare mentions to r(varlist) as you need ` ' to do that.

    Comment

    Working...
    X