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: gen a variable


From   Nick Cox <[email protected]>
To   "'[email protected]'" <[email protected]>
Subject   st: RE: gen a variable
Date   Thu, 22 Mar 2012 15:37:27 +0000

Look at the help for -egen-. 

sysuse auto 
tab rep78, su(foreign) 
egen mean_foreign = mean(foreign), by(rep78) 
tabdisp rep78, c(mean_foreign) 

may indicate technique. 

Nick 
[email protected] 

Chiara Mussida

I wanto to gen variable for the sample proportions: men and women in
each occupation.
Command:
sum hwage lwage edu1 edu2 edu3 fem age married ftc northw northe
centre south partime pexper ncomp nkid3 nkid36 nkid612 d09 d10 if
cond3==1 & age>=15 & age<=64 & dipind==1 & hours>20 & hours<55 &
occupation==1

showsme the proportion I want to hava as a variable for each
occupation and gender. It is the value of fem (its mean). Is there a
way to generate a variable which takes the value computed by sum (for
each category) automatically in Stata after each sum?


*
*   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