Announcement

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

  • Error while trying to collapse data using semean

    Hello team,
    I am trying to collapse my dataset by mean and semean. I used the following syntax:
    local endsys
    local group1 visitinobs_grp
    local group2 hypertensive
    collapse (mean) sysmean=`varname' (semean) syssemean=`varname', by (`group1' `group2')

    However, I am repeatedly getting the following error:
    variablesemean not found

    Please help! Below is the sub-set of my data.

    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input float(endsys visitinobs_grp) byte hypertensive
    132 4 1
    164 2 1
    160 1 1
    136 6 0
    139 2 0
    120 2 0
    120 3 0
    139 4 0
    103 2 1
    144 5 1
    129 0 1
    133 0 0
    135 1 1
    end
    [/CODE]



  • #2
    Sorry, there was an error in my command. Correct command is:
    local varname endsys
    local group1 visitinobs_grp
    local group2 hypertensive
    collapse (mean) sysmean=`varname' (semean) syssemean=`varname', by (`group1' `group2')

    I have got the desired output. Thanks anyway!

    Comment

    Working...
    X