Notice: On March 31, it was **announced** that Statalist is moving from an email list to a **forum**. The old list will shut down on April 23, and its replacement, **statalist.org** is already up and running.

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

From |
Partha Deb <partha.deb@hunter.cuny.edu> |

To |
Statalist <statalist@hsphsun2.harvard.edu> |

Subject |
st: Memory requirements for factor variables |

Date |
Sun, 02 May 2010 18:29:52 -0400 |

Hi all,

regress y x i.D

forvalues i=1/100 { gen byte ID`i' = (D==`i') }

forvalues i=1/100 { gen byte ID`i' = (D1==`i' | D2==`i' | D3==`i' | D4==`i') }

Partha ****** do ******* clear all set mem 10m set more off set seed 123456 set obs 100000 gen x = rnormal() gen u = rnormal() gen int d = int(_n/1000) gen y = x + u describe,s qui regress y x i.d sum d forvalues i=1/`r(max)' { gen byte Id`i' = (d==`i') } describe,s regress y x Id* exit ******* log ********** . clear all . set mem 10m Current memory allocation current memory usage settable value description (1M = 1024k) -------------------------------------------------------------------- set maxvar 5000 max. variables allowed 1.909M set memory 10M max. data space 10.000M set matsize 400 max. RHS vars in models 1.254M ----------- 13.163M . set more off . . set seed 123456 . . set obs 100000 obs was 0, now 100000 . . gen x = rnormal() . gen u = rnormal() . gen int d = int(_n/1000) . . gen y = x + u . . describe,s Contains data

. . qui regress y x i.d . . sum d Variable | Obs Mean Std. Dev. Min Max -------------+-------------------------------------------------------- d | 100000 49.501 28.86623 0 100 . . forvalues i=1/`r(max)' { 2. gen byte Id`i' = (d==`i') 3. } no room to add more variables because of width

1. Store existing variables more efficiently; see help compress.

area of a rectangle; Stata can trade off width and length.)

see help memory. r(902); -- Partha Deb Professor of Economics Hunter College ph: (212) 772-5435 fax: (212) 772-5398 http://urban.hunter.cuny.edu/~deb/ Emancipate yourselves from mental slavery None but ourselves can free our minds. - Bob Marley * * 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/

**Follow-Ups**:**Re: st: Memory requirements for factor variables***From:*f.belotti@econometrics.it

**Re: st: Memory requirements for factor variables***From:*Federico Belotti <f.belotti@econometrics.it>

**Re: st: Memory requirements for factor variables***From:*Reifschneider Harry III <reifschneiderh3@gmail.com>

- Prev by Date:
**st: RE: comas in numbrers** - Next by Date:
**st: RES: RE: comas in numbrers** - Previous by thread:
**st: RE: comas in numbrers** - Next by thread:
**Re: st: Memory requirements for factor variables** - Index(es):