Statalist


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

Re: st: aggregating data & local macros


From   Maarten buis <[email protected]>
To   [email protected]
Subject   Re: st: aggregating data & local macros
Date   Sun, 1 Jun 2008 09:28:10 +0100 (BST)

--- "mac.stata" <[email protected]> wrote:
> 1. aggregating data
> I have records of individuals on the community level and these should
> be matched with data on the district level (I have district numbers I
> can match; I will use "joinby"). Which is the right way to go: 
>
> a) have the two data sets put together with "joinby" and then try
> using "collapse" to aggregate the data on a district level (and then
> regress the data on the district level), or 
>
> b) again�on the community level�put the data sets together first but
> then work with the Stata command "xi: ... ... ... i.districts"? 
>
> As these are records of individuals containing socio-economic data it
> might get very difficult when using "collapse", I think. So, is the
> "xi:" actually the right way to go? 

This is basically a multilevel problem, so the set of tools for are not
-xi- but -xt-, see -help xt-. When doing your analysis on an aggregate
level the thing to look out for is called the ecological fallacy, see
for a describtion and some references here:
http://www.stata.com/statalist/archive/2006-07/msg00584.html

> 2. local macro
<snip>
> because it is a long list of variables I wanted to manually use line 
> breaks. I therefore used the "#delimit ;"  and "#delimit cr" before  
> and after the definition of the local macro << local local_var = " A
> B C D ... Z" >>. I thought this performs fine, also because I did not
 
> get any error but when I checked if all went right, it showed that  
> after the third (of about five) line breaks the variables were  
> ignored. 

The problem is not the line breaks but the =. There should be no
problem if you type:
local local_var "A B C D ... Z"

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


      __________________________________________________________
Sent from Yahoo! Mail.
A Smarter Email http://uk.docs.yahoo.com/nowyoucan.html
*
*   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