Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


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

st: expandcl and not small datasets


From   Tomas Lind <tomas.lind@sll.se>
To   statalist@hsphsun2.harvard.edu
Subject   st: expandcl and not small datasets
Date   Wed, 19 Dec 2012 16:56:41 +0100

Hi all,

Problem with -expandcl- when expanding a dataset with 30 000 rows. 


I´m preparing a dataset for a case-crossover analysis. A CC-group may have 4 or 5 rows of data. Depending on the number of cases in this CC-group (as given by a variable "tot") I duplicate this CC-group tot number of times using -expandcl- (because each of these groups have a case in different points of time). This doesn´t work in a large dataset. The fake data generated below illustrates the problem. Stata doesn´t give any error message and I can´t find any warnings or limits in the help and documentation. Does anyone have more information on this? One solution may be to split the dataset in smaller parts. Maybe there are other solutions?


** Generate some fake data ------------------   
clear*
set obs 30000
egen  double id = fill(1,1,1   2,2,2)  
gen tot=3     

expandcl tot, generate(id2) cluster(id)

sort id2 id  , stable
order id  id2


** Look at data -----------------------------
* In the list below everything looks fine
* id=1 has been split into 3 groups and are identified by id2
* The same applies to id=2   
list  in 1/18          , sepby(id2)

* But here id=6335 have not been split into 3 groups identified by id2
* and the same applies to a lot of other id´s.
list  in 57000/57018   , sepby(id2)



I run Stata 11.1 on a PC with Windows 

/Tomas
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index