Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: percentages


From   Maarten buis <[email protected]>
To   [email protected]
Subject   Re: st: percentages
Date   Mon, 30 Apr 2007 09:15:18 +0100 (BST)

--- [email protected] wrote:
> I want me to create a "liberal" variable and a "conservative"
> variable by isolating the people who score in the top 25th
> percentile in a  composite personal freedoms variable and the bottom
> 25th percentile in  a capitalism variable, using various questions
> from NES.
> 
> One person told me to use
> 
> gen liberal = 1 if capitalism< pctx & personal > pctx
> recode liberal .=0
> 
> where the x after pct (percentage) would be 75%
> 
> However, the pct command is not a function.
> 
> Do you know how I would get the result I wanted in stata?
 
One way is shown in the example below:
*-------------- begin example --------------
sysuse nlsw88, clear
sum tenure, detail
local top25 = r(p75)
sum wage, detail
local bottom25 = r(p25)
gen liberal = tenure >`top25' & wage < `bottom25' /*
*/ if !missing(tenure,wage)
*-------------- end example ----------------
(For more on how to use examples I sent to the Statalist, see:
http://home.fsw.vu.nl/m.buis/stata/exampleFAQ.html )

-----------------------------------------
Maarten L. Buis
Department of Social Research Methodology
Vrije Universiteit Amsterdam
Boelelaan 1081
1081 HV Amsterdam
The Netherlands

visiting address:
Buitenveldertselaan 3 (Metropolitan), room Z434

+31 20 5986715

http://home.fsw.vu.nl/m.buis/
-----------------------------------------


      ___________________________________________________________
Yahoo! Answers - Got a question? Someone out there knows the answer. Try it
now.
http://uk.answers.yahoo.com/ 
*
*   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/



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