Announcement

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

  • How to calculate the sum of each unique value which has appeared?

    Dear all,

    I am checking the statalist forum quite a while and now I cannot help myself, but it cannot be so difficult.

    I am trying to count the unit digits over several columns, which have appeared in an experiment, to finally create a table of the distribution of unit digits.
    In the picture one can see the distribution of one column, but I need that for table 6 columns.

    Thank you very much, for your help.
    ps. I just found on google how to count distinct unique values and all varieties

    Dropbox is a free service that lets you bring your photos, docs, and videos anywhere and share them easily. Never email yourself a file again!

  • #2
    Anton,
    I don't see the link between the title and the core of the post.
    Moreover, you post in the mata section of the forum while you don't seem to use mata.
    You'll have a better chance to get an answer by posting in the general section, and explaining better your issue.
    From what I understand, I'd advice you a reshape long to put your 6 ``columns" (actually variables) into one, and then doing what you did in the screenshot. But perhaps that isn't what you wanted.

    Otherwise, if you do want to calculate the sum of each unique value which has appeared, you should store them in locals, and sum them afterward (or in a loop).

    Best,

    Comment

    Working...
    X