Announcement

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

  • How to combine dtables showing levels of each var

    Hi, hope you be well.

    I need a little help here, I would like to combine multiple dtables while expanding the levels of each control variable across my outputs. Here is my attempted code:

    collect clear

    dtable i.destino ing_max if adulto_joven == 1, by(sexo, notot test) name(sexo) ///
    factor(, statistics(fvfrequency fvpercent )) ///
    nformat(%16.0fc fvfrequency) ///
    nformat(%9.1f fvpercent) ///
    continuous(, statistics(mean sd)) ///
    nformat(%9.0f mean sd) ///
    sformat((%s) semean)


    dtable i.destino ing_max if adulto_joven == 1, by(nivel_educ, notot test) name(nivel_educ) ///
    factor(, statistics(fvfrequency fvpercent )) ///
    nformat(%16.0fc fvfrequency) ///
    nformat(%9.1f fvpercent) ///
    continuous(, statistics(mean sd)) ///
    nformat(%9.0f mean sd) ///
    sformat((%s) semean)

    collect combine tablas = sexo nivel_educ
    collect layout (var) (group#result)

    collect preview



    The output i get is:

    collect layout (var) (group#result)

    Collection: tablas
    Rows: var
    Columns: group#result

    Your layout specification does not uniquely match any items. One or more of the following
    dimensions might help uniquely match items: across, cmdset, collection, colname, destino,
    nivel_educ, result, sexo, statcmd.



    I'm aware too that i could use a loop but my principal concern it's about the combine.

    Thanks

  • #2
    Please provide a data example to accompany your code above. See FAQ Advice #12 for details on how to do this.

    Comment


    • #3
      Andrew, ok:

      clear

      input float(destino ing_max) byte sexo float nivel_educ
      . . 1 0
      . . 0 0
      . . 1 0
      . . 1 0
      . . 1 0
      . . 1 0
      . . 0 0
      0 . 1 0
      . . 1 0
      . . 1 0
      . . 0 0
      1 30000 1 1
      . . 0 0
      0 65000 1 0
      . . 1 1
      . . 1 0
      . . 0 0
      . . 1 1
      . . 1 0
      . . 0 0

      Comment


      • #4
        Forget it, I solved it:

        collect layout (var) (sexo#result nivel_educ#result)

        Thanks

        Comment

        Working...
        X