Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

st: Re: st: (inget ämne)


From   Nick Cox <[email protected]>
To   [email protected]
Subject   st: Re: st: (inget ämne)
Date   Mon, 7 Mar 2011 13:01:27 +0000

Your code can be shortened to

sum roa if id ==20,d
gen roa20 = roa if id == 20 & roa <= 14.167 & roa > -14.665

The effect is that roa20 is a copy of roa for id == 20 but with values
outside certain limits set to missing. Is that what you want?

But I think you have to explain what 14.167 -14.665 are. Presumably
they arise in the output of -summarize-, but we have no way of working
out what they are.

Tharshini Thangavelu

> I have to produce the following command in Stata for 90 countries. Instead
> of copying the command here below 90 times, I would like to change the
> command so that I just need to do this one time, like a loop so that it
> takes all the 90 countires.
> Now I have done for 20 countries separately, but doing this for 70 more
> countries seems very inefficiency and unproductive.
>
> roa is the variable which denotes the return of asset.
>
> sum roa if id ==20,d
> gen avkas =.
> replace avkas = roa if id==20
> gen roa20 = avkas if avkas <= 14.167 & avkas > -14.665
> drop avkas
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index