Announcement

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

  • Create table by using a tag from duplicates command

    Hi,

    I have tried to google my best and search the forum but I can't seem to find something regarding my (very simple, I'm afraid) problem.

    I have a large dataset where some observations have the same ID-number (aka one patient have two observations). To find these, I have used the duplicates command, and created a new variable:
    Code:
    duplicates tag ID_CODE, generate(tags)
    I have found 150 duplicates.

    I would now like to create a table with the duplicates (I figured I could do that by using the new tags-variable) and the date (variable DATE) the observation was made, creating a table with the ID_CODE and DATE of all duplicates displayed.
    Sadly, my Stata-knowledge doesn't seem to get me there

    Any advice would be greatly appreciated!

  • #2
    Is

    Code:
    tab ID_CODE if tags
    what you want?

    Comment


    • #3
      Thanks for your quick response! Yes, partly, but I would like to have ID_CODE and DATE in the same table.

      Comment


      • #4
        Code:
        groups ID_CODE DATE if tags
        where groups is downloadable via

        Code:
        . search st0496, entry
        
        Search of official help files, FAQs, Examples, and Stata Journals
        
        SJ-18-1 st0496_1  . . . . . . . . . . . . . . . . . Software update for groups
                (help groups if installed)  . . . . . . . . . . . . . . . .  N. J. Cox
                Q1/18   SJ 18(1):291
                groups exited with an error message if weights were specified;
                this has been corrected
        
        SJ-17-3 st0496  . . . . .  Speaking Stata: Tables as lists: The groups command
                (help groups if installed)  . . . . . . . . . . . . . . . .  N. J. Cox
                Q3/17   SJ 17(3):760--773
                presents command for listing group frequencies and percents and
                cumulations thereof; for various subsetting and ordering by
                frequencies, percents, and so on; for reordering of columns;
                and for saving tabulated data to new datasets
        Download from st0496_1 but read st0496's paper or https://www.statalist.org/forums/for...updated-on-ssc if more details are needed.

        Comment


        • #5
          Nick, thank you so much! This worked perfectly!

          Comment

          Working...
          X