Statalist The Stata Listserver


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

RE: st: data formatting question


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   RE: st: data formatting question
Date   Tue, 14 Feb 2006 01:36:41 -0000

Nick 
[email protected] 

> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]]On Behalf Of Andy Choi
> Sent: 14 February 2006 01:24
> To: [email protected]
> Subject: Re: st: data formatting question
> 
> 
> Using this same example from previous emails is there
> a command that would sort by country number when
> defining a new variable?
> 
> For example, I have tried something like this without
> success:
> by countrynumber: gen new_var=0
> by countrynumber: replace new_var=1 if year=="1930" &
> ethnicity=="Hispanic"
> I want the end result to be 0 or 1 for each unque
> country number value.  
> 
> 
> > Country Number	year	ethnicity	ethnicpop
> > 10		1930	Caucasion	1,000,000
> > 10		1930	Hispanic	50,000
> > 10		1931	Caucasion	1,000,100
> > 10		1931	Hispanic	51,000
> > 11		1931	Asia		10,000
> >
> > I want to set up the data so there is only one entry
> > per country per year,
> > as follows:
> > 
> > Country Number	year	ethnic1	   ethnic2   ethpop1   
> > ethpop2
> > 10		1930	Caucasian  Hispanic  1,000,000	50,000
> > 
> > Any ideas people have would be greatly appreciated.
> > 
> > Sincerely,
> > Michael Horowitz
> > *
> > *   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/
> > 
> 
> 
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around 
> http://mail.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/
> 

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