Announcement

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

  • egen and tag

    Hello I am having a trouble in doing some analysis with stata.

    The variables are
    hospitalid : unique hospital id
    emrvendor: name of emr software
    emrfunctions: name of application
    rural: if hospital is located in rural area =1 otherwise =0

    Hospitals can utilize different EMR vendors for different emrfunctions.

    1) Frequency table of numbers of emr vendors used per hospital

    I would like to calculate the number of emr vendors per each unique hospital and show the frequency table.
    what i did is
    egen tag_emrvendor=tag(hospitalid emrvendor)
    bysort hospitalid: egen n_vendors=total(tag_vendor)
    But I can't make the frequency table which shows the number of vendors used per hospital

    2) EMR functions that a different emrvendor is used per hospital
    If a hospital is using different vendors for certain emrfunctions, I would like to show which function goes to different vendors. most frequent functions that hospital is using different vendors.

    Could you please help me in this? Please...


  • #2
    If you want a table showing each hospital and the number of vendors it uses, you were almost there:

    Code:
    egen flag = tag(hospitalid emrvendor)
    tab hospitalid if flag
    The above code will tag one record for each combination of hospitalid and emrvendor. Then when you tabulate hospitalid restricting to flagged observations, each hospital will be counted precisely once for each distinct emrvendor it uses.

    I don't understand what you want in 2), so I'll stop here.

    Comment


    • #3
      Your code may not be what you typed:

      Code:
      egen tag_emrvendor=tag(hospitalid emrvendor)
      bysort hospitalid: egen n_vendors=total(tag_vendor)
      Where did tag_vendor come from?

      Don't rely on memory. Copy and paste exactly what you typed.

      "But I can't make the frequency table which shows the number of vendors used per hospital."

      What code did you try? We can't say what you did wrong without knowing what you tried.

      Here is some technique:

      Code:
      . sysuse auto
      (1978 Automobile Data)
      
      . egen tag = tag(rep78 foreign)
      
      . egen total_tag = total(tag), by(foreign)
      
      . tabdisp foreign, c(total_tag)
      
      ----------------------
       Car type |  total_tag
      ----------+-----------
       Domestic |          5
        Foreign |          3
      ----------------------


      Comment


      • #4

        Thank you! I used the below code.
        The variable name is a little bit different.

        haentityid is the hospital id
        vendor is ehr vendor
        application is the emrfunction.



        unique haentityid vendor application // to check the uniqueness

        egen tag_vendor=tag(haentityid vendor) //tag unique vendor per organization
        fre tag_vendor

        bysort haentityid: egen n_vendors=total(tag_vendor) //number of vendors used per hospital
        egen tag_haentityid=tag(haentityid)

        fre n_vendors if tag_haentityid==1 & tag_vendor==1
        fre n_vendors if tag_haentityid==1 & tag_vendor==1 & rural ==0
        fre n_vendors if tag_haentityid==1 & tag_vendor==1 & rural ==1


        By doing this, i could show the frequency table about the number of emr vendors used per hospital.

        But, still I am lost in question 2.
        There are 6 different applications for which a hospital use emr.
        A hospital may use one EMR vendor (EPIC) for 5 applications and the other emr vendor (MEDITECH) for 1 application.
        or A hospital may use two emr vendors for two different applications. for example, EPIC for patient portal and MEDITECH for physician portal.
        or a hospital may use just one vendor for 6 different applications. EPIC for all.

        I would like to see which application was tended to be with different emr vendor within an hospital.
        for example, hospitals use different vendor for patient portal..

        Comment


        • #5
          Sorry; perhaps like Clyde I got lost in the middle of Q.2.

          (Your last post uses several user-written commands. You are asked to explain where they come from.)

          Comment

          Working...
          X