Equivalent function of R's “%in%” for Stata

前端 未结 3 1478
遥遥无期
遥遥无期 2021-01-19 20:08

Is there an equivalent function of \"%in%\" from R for Stata?

3条回答
  •  春和景丽
    2021-01-19 20:32

    As already mentioned, it's hard to tell what you need from the question. inlist() might work, or it might not depending on the setting.

    I find that Stata's macro lists functions are invaluable. Store your list in a macro (local or global) and then a suite of useful commands are available:

    local list   a b c d d e 
    local search c 
    local search_in_list : list search in list
    di    `search_in_list'
    

    These can be calculated on the fly:

    if `: list search in list' {
        actions if true
    }
    

提交回复
热议问题