If I understand this correctly, you want something
like this:
. su depcom if nomcom == "Acheres", meanonly
. local mymacro "`r(min)'"
That is, if only one observation is for the commune
of Acheres, then -depcom- for that observation
will be the minimum (and also the maximum,
and the mean) of -depcom- with the -if- condition.
This assumes that -depcom- is numeric.
At worst, -depcom- is string. Then you must do
something like this:
gen long ordre = _n
su ordre if nomcom == "Acheres", meanonly
local mymacro "`= depcom[`r(min)']'"
Nick
[email protected]
Jean-Benoit Hardouin
> In my mail, you must replace "I want to save a specific values of the
> variable "nomcom" into a variable, for example," by "I want to save a
> specific values of the variable "nomcom" into a macro, for example,"
> JB Hardouin
>
> Jean-Benoit Hardouin a �crit:
>
> > I have a file like that :
> >
> > . list depcom nomcom in 1/5
> >
> > +-----------------------------+
> > | depcom nomcom |
> > |-----------------------------|
> > 1. | 18001 Acheres |
> > 2. | 18002 Ainay-le-Vieil |
> > 3. | 18003 Les Aix-d'Angillon |
> > 4. | 18004 Allogny |
> > 5. | 18005 Allouis |
> > +-----------------------------+
> >
> > Where depcom is an id. I want to save a specific values of the
> > variable "nomcom" into a variable, for example, I want to obtain :
> > . di "`mymacro'"
> > Archeres
> >
> > I don't find how to do that. Thank you for your help.
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/