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

st: macro length exceeded

From   Vincenzo Carrieri <[email protected]>
To   [email protected]
Subject   st: macro length exceeded
Date   Sat, 7 Nov 2009 11:10:11 +0100

Dear statalisters,
I have tried to run the loop one statalister suggested me to assign
the mean of income calculated to the person with
same education, same region, same activity and falling in an age
interval. The loop suggested me is the following:

set obs 1000
gen personid=_n

gen byte region= irecode(_n,0,1000,5000,10000)
gen income= rnormal(0,100)+1500
gen byte education=9+int(8*runiform())
gen byte activity=int(10*runiform())
gen age=20+int(10*runiform())

//generate var to be filled later on
gen meanincome=.
//also count the number of "peers"
gen count=.

qui levelsof personid

qui foreach id of numlist `r(levels)'{
       tempvar touse
       gen byte `touse'=region==region[`id'] & /*
       */ education==education[`id'] & /*
       */ activity==activity[`id'] & /*
       */ inrange(age, age[`id']-5, age[`id']+5)
       su income if `touse', mean
       replace meanincome=r(mean) if `touse'
       replace count=r(N) if `touse'

 The problem is that I have 128040 individuals and I cannot set obs
1000 as the statalister suggested me ( stata gives me this error:
obs must be between 128040 and 1060356). then If I skip to set obs and
I work with all my 128040 individuals, stata says me: macro length

Ho can I solve this problem? is it because my data-set is too big? I
have set mem 800m and matsize 90, is it not enough?

Many thanks

*   For searches and help try:

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