[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: st: extracting matrix row to macro

From   "Nick Cox" <>
To   <>
Subject   RE: st: extracting matrix row to macro
Date   Mon, 29 Jun 2009 13:26:17 +0100

When Reed writes of unique values, I presume that distinct values are

In addition to Eva's suggestion, which is spot on, a more detailed
discussion of identifying distinct values is to be found in 

SJ-8-4  dm0042  . . . . . . . . . . . .  Speaking Stata: Distinct
        (help distinct if installed)  . . . . . .  N. J. Cox and G. M.
        Q4/08   SJ 8(4):557--568
        shows how to answer questions about distinct observations
        from first principles; provides a convenience command


Eva Poen

You can use -levelsof- for this task:

levelsof x if y > 40, local(mymacro)

The levels of x will be stored in the macro mymacro. You can add
delimiters if you want.

2009/6/28 Reed Walker <>:

> I am tabulating a variable and getting a series of frequencies and
> values.
> I am interested in using the unique values later in the program.
> tabulate x if y>40, matcell(m) matrow(m1)
> Thus, I want to put the contents of matrix m1 (a vector) into a local
> There must be an easy way to do this, but I have thus far come up

*   For searches and help try:

© Copyright 1996–2022 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index