Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: Re: aorder: system limit exceeded


From   James Muller <[email protected]>
To   [email protected]
Subject   Re: st: Re: aorder: system limit exceeded
Date   Fri, 01 Jul 2005 15:44:13 +1000

It's something to do with the updated release of aorder.

When I run release 2.2.2 found in the 'base' adopath directory of Stata 8 it works fine; the release in the 'update' adopath directory dispays the bug. Since 2.2.2 is not available in Stata9 I have included the 2.2.2 programs at the bottom of this post - save the code as "aorder.ado" in the appropriate place.

A crude way of fixing this, -I believe-, is to copy the old release to update path and change the version numbering so it won't get overwritten. I'm not sure of the mechanics of the update process, but if you trick whatever mechanism is used into thinking the old release is the current, then when the new (corrected) release, "version 2.2.4", is provided then your aorder will automatically update.

Try a few things (a) modifying the file slightly so its timestamp is more recent than the release 2.2.3 file; (b) changing the version number header (the "*! version 2.2.2 31jul2001" to "*! version 2.2.3 20aug2003"); and of course (c) anything else you think of. Someone with more experience with update can offer a more definite suggestion.

The 'old' version is
*! version 2.2.2 31jul2001
The 'new' version is
*! version 2.2.3 20aug2003

I'll have a look to see if the problem with the code is obvious.

Another relevent question is: Does anyone know what the rationalle for updating to 2.2.3 was? Is there any real loss by using the previous release?

Cheers

James



-----------------------------
aorder.ado
-----------------------------


*! version 2.2.2 31jul2001
program aorder
version 6, missing
syntax [varlist]
local n : word count `varlist'
if `n' <= 1 { exit }
preserve quietly { tempvar name
drop _all set obs `n'
gen str32 `name' = ""
tokenize `varlist'
local i 1 while "``i''" != "" {
replace `name' = "``i''" in `i'
local i = `i'+1
}

SortAord `name'

local i 1 while "``i''" != "" { local x = `name'[`i']
local newlist "`newlist' `x'"
local i = `i'+1
}
restore
order `newlist'
}
end


program SortAord
syntax varname [in]

if "`in'" ~= "" {
tokenize "`in'", parse(" /")
local first "`2'"
local last "`4'"
}
else {
local first 1
local last = _N
}

quietly {
tempvar name l stub digits nonumb group
gen str32 `name' = `varlist' `in'
gen int `l' = index(`name',"0") `in'
replace `l' = . if `l'==0 `in'
local i 1
while `i' <= 33 {
replace `l' = index(`name',"`i'") if /*
*/ index(`name',"`i'")<`l' & /*
*/ index(`name',"`i'")!=0 `in'
local i = `i' + 1 }
replace `l' = 33 if `l'>=. `in'
gen str32 `stub' = substr(`name',1,`l'-1) `in'
local i 1
gen long `digits' = real(substr(`name',`l',`i')) `in'
while `i' < 31 {
local i = `i' + 1
replace `digits' = real(substr(`name',`l',`i')) `in' /*
*/ if `digits'<. /*
*/ & real(substr(`name',`l',`i'))<.
}
gen byte `nonumb' = -1 if `digits'>=. `in'
sort `stub' `nonumb' `digits' `in'
drop `nonumb'
replace `stub' = `stub' + string(`digits') `in'
drop `digits'
local i 1
local flag 0
while `i' <= _N & `flag'==0 {
if `name'[`i'] != `stub'[`i'] {
local flag 1
}
local i = `i' + 1
}
if `flag' == 1 {
encode `stub' `in', gen(`group')
if `group'[`last'] != (`last'-`first'+ 1) {
replace `l' = length(`stub') `in'
replace `name' = substr(`name',`l'+1,.) `in'
local i `first'
while `i' < `last' {
if `group'[`i']==`group'[`i'+1] {
local start `i'
while `group'[`i']== /*
*/ `group'[`i'+1] {
local i = `i' + 1
}
local finish `i'
SortAord `name' /*
*/ in `start'/`finish'
}
else {
local i = `i' + 1
}
}
}
}
}
end


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