Economics should be open

March 26, 2009

Stata “unique” command helpful

Filed under: Stata — howardchong @ 9:58 pm

I just found the unique stata command.

PROBLEM: I have a correspondence table of companies to domains. One company can have multiple domains. I wanted a count of the number of unique companies.
SOLUTION: download the “unique” stata command. Install by running “ssc install unique”. You can also read more about it from the site: http://ideas.repec.org/c/boc/bocode/s354201.html

ALTERNATIVE: I used to just do “keep company” and then “duplicates drop”. It was a hack, but it worked. If you have a small number, a easy way to do it is “tab company” and just count the lines.

Advertisements

3 Comments »

  1. Here is sample output of the unique command:

    . unique company
    Number of unique values of company is 103
    Number of records is 202

    Comment by howardchong — March 26, 2009 @ 9:59 pm

  2. very helpful! THX!

    Comment by Daisy Lam — August 30, 2012 @ 7:27 pm

  3. awesome

    Comment by MrDesignDataAnalysis — January 20, 2014 @ 3:53 am


RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Create a free website or blog at WordPress.com.

%d bloggers like this: