Statalist The Stata Listserver


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

Re: st: Re: memory problem where over 50% of memory are free


From   "Michael Blasnik" <[email protected]>
To   <[email protected]>
Subject   Re: st: Re: memory problem where over 50% of memory are free
Date   Tue, 10 Apr 2007 08:46:56 -0400

Woops, as usual Nick is correct. I meant to reference year2[_N] and not max(year2).

Also, Nick's approach to dealing with missing values is clearly superior since it saves creating a variable (assuming you don't have any negative years).

Michael

----- Original Message ----- From: "n j cox" <[email protected]>
To: <[email protected]>
Sent: Tuesday, April 10, 2007 8:40 AM
Subject: Re: st: Re: memory problem where over 50% of memory are free



Michael didn't mean what he suggested here. The -max()-
function needs two or more arguments and has different syntax
from -egen, max()-.

I think Michael is thinking of code like this:

sort persnr year2
by persnr : gen int maxyear2 = year2[_N]

or, if there are missings, something like

gen maxyear2 = cond(missing(year2), 0, year2)
sort persnr maxyear2
by persnr : replace maxyear2 = maxyear2[_N]

will mean one fewer variable.

Nick
[email protected]

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