Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

RE: st: RE: RE: RE: Expression too long


From   keeler james <[email protected]>
To   <[email protected]>
Subject   RE: st: RE: RE: RE: Expression too long
Date   Sun, 11 Apr 2010 21:27:37 +0100

Many thanks, Martin and Nick. I shall have a try. Have a nice week.

Calchas

----------------------------------------
> From: [email protected]
> To: [email protected]
> Subject: st: RE: RE: RE: Expression too long
> Date: Sun, 11 Apr 2010 18:37:24 +0200
>
>
> <>
>
> My description was a little incomplete, admittedly:
>
>
> *************
> clear*
> set obs 6
>
> gen str5 cntrno="AGER"
> replace cntrno="AIER" in 2
> replace cntrno="derer" in 3
> replace cntrno="ghter" in 4
> replace cntrno="GTrer" in 5
> replace cntrno="HLrer" in 6
>
> gen byte tokeep =inlist(substr(cntrno,1,2),"AG","AI","AN")
> replace tokeep=inlist(substr(cntrno,1,2),"HL","HT") | tokeep
>
> list, noo
>
> keep if tokeep
>
> list, noo
> *************
>
>
> HTH
> Martin
>
>
> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]] On Behalf Of Nick Cox
> Sent: Sonntag, 11. April 2010 18:15
> To: [email protected]
> Subject: st: RE: RE: Expression too long
>
> This won't work. Once you've -drop-ped those that aren't AG, AI, AN, it's
> too late to give the others another chance as being something else -- unless
> you cycle through -save-, -use- main dataset, etc.
>
> That is, you want to -keep- with an OR condition, not -keep- with an AND
> condition.
>
> (I nearly posted the same underlying idea.)
>
> Nick
> [email protected]
>
> Martin Weiss
>
> You could use -inlist- with up to 10 string arguments, and -generate- /
> -replace- a dummy "tokeep", until finally you -keep- only the obs that
> -tokeep- identifies.
>
> *************
> clear*
> set obs 3
>
> gen str5 cntrno="AGER"
> replace cntrno="AIER" in 2
> replace cntrno="derer" in 3
>
> gen byte tokeep =inlist(substr(cntrno,1,2),"AG","AI","AN" )
>
> list, noo
>
> keep if tokeep
> *************
>
> keeler james
>
> I was using the following command, but the Stata output said:
>
> expression too long
> r(130);
>
> end of do-file
> r(130);
>
> Any idea of how to get round this? Many thanks.
>
> Calchas
>
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>
> The command was (just one command):
>
> qui keep if substr(cntrno,1,2)=="AG" | substr(cntrno,1,2)=="AI" | /*
> */ substr(cntrno,1,2)=="AN" | substr(cntrno,1,2)=="AR" |
> substr(cntrno,1,2)=="AW" | /*
> */ substr(cntrno,1,2)=="BB" | substr(cntrno,1,2)=="BM" |
> substr(cntrno,1,2)=="BO" | /*
> */ substr(cntrno,1,2)=="BR" | substr(cntrno,1,2)=="BS" |
> substr(cntrno,1,2)=="BZ" | /*
> */ substr(cntrno,1,2)=="CA" | substr(cntrno,1,2)=="CL" |
> substr(cntrno,1,2)=="CO" | /*
> */ substr(cntrno,1,2)=="CR" | substr(cntrno,1,2)=="CU" |
> substr(cntrno,1,2)=="DM" | /*
> */ substr(cntrno,1,2)=="DO" | substr(cntrno,1,2)=="EC" |
> substr(cntrno,1,2)=="FK" | /*
> */ substr(cntrno,1,2)=="GD" | substr(cntrno,1,2)=="GF" |
> substr(cntrno,1,2)=="GP" | /*
> */ substr(cntrno,1,2)=="GT" | substr(cntrno,1,2)=="GY" |
> substr(cntrno,1,2)=="HN" | /*
> */ substr(cntrno,1,2)=="HT" | substr(cntrno,1,2)=="JM" |
> substr(cntrno,1,2)=="KN" | /*
> */ substr(cntrno,1,2)=="KY" | substr(cntrno,1,2)=="LC" |
> substr(cntrno,1,2)=="MQ" | /*
> */ substr(cntrno,1,2)=="MS" | substr(cntrno,1,2)=="MX" |
> substr(cntrno,1,2)=="NI" | /*
> */ substr(cntrno,1,2)=="PA" | substr(cntrno,1,2)=="PE" |
> substr(cntrno,1,2)=="PR" | /*
> */ substr(cntrno,1,2)=="PY" | substr(cntrno,1,2)=="SR" |
> substr(cntrno,1,2)=="SV" | /*
> */ substr(cntrno,1,2)=="TC" | substr(cntrno,1,2)=="TT" |
> substr(cntrno,1,2)=="US" | /*
> */ substr(cntrno,1,2)=="UY" | substr(cntrno,1,2)=="VC" |
> substr(cntrno,1,2)=="VE" | /*
> */ substr(cntrno,1,2)=="VG" | substr(cntrno,1,2)=="VI" |
> substr(cntrno,1,2)=="T1" | /*
> */ substr(cntrno,1,2)=="T2" | substr(cntrno,1,2)<="99" |
> substr(cntrno,1,2)=="AA" |/*
> */ substr(cntrno,1,2)=="AD" | substr(cntrno,1,2)=="AL" |
> substr(cntrno,1,2)=="AO" | /*
> */ substr(cntrno,1,2)=="AT" | substr(cntrno,1,2)=="BA" |
> substr(cntrno,1,2)=="BE" | /*
> */ substr(cntrno,1,2)=="BF" | substr(cntrno,1,2)=="BG" |
> substr(cntrno,1,2)=="BH" | /*
> */ substr(cntrno,1,2)=="BI" | substr(cntrno,1,2)=="BJ" |
> substr(cntrno,1,2)=="BW" | /*
> */ substr(cntrno,1,2)=="BY" | substr(cntrno,1,2)=="CF" |
> substr(cntrno,1,2)=="CH" | /*
> */ substr(cntrno,1,2)=="CI" | substr(cntrno,1,2)=="CM" |
> substr(cntrno,1,2)=="CY" | /*
> */ substr(cntrno,1,2)=="CZ" | substr(cntrno,1,2)=="DE" |
> substr(cntrno,1,2)=="DJ" | /*
> */ substr(cntrno,1,2)=="DK" | substr(cntrno,1,2)=="DZ" |
> substr(cntrno,1,2)=="EA" | /*
> */ substr(cntrno,1,2)=="EE" | substr(cntrno,1,2)=="EG" |
> substr(cntrno,1,2)=="ER" | /*
> */ substr(cntrno,1,2)=="ES" | substr(cntrno,1,2)=="ET" |
> substr(cntrno,1,2)=="FI" | /*
> */ substr(cntrno,1,2)=="FO" | substr(cntrno,1,2)=="FR" |
> substr(cntrno,1,2)=="GA" | /*
> */ substr(cntrno,1,2)=="GB" | substr(cntrno,1,2)=="GH" |
> substr(cntrno,1,2)=="GI" | /*
> */ substr(cntrno,1,2)=="GM" | substr(cntrno,1,2)=="GN" |
> substr(cntrno,1,2)=="GQ" | /*
> */ substr(cntrno,1,2)=="GR" | substr(cntrno,1,2)=="HR" |
> substr(cntrno,1,2)=="HU" | /*
> */ substr(cntrno,1,2)=="IE" | substr(cntrno,1,2)=="IL" |
> substr(cntrno,1,2)=="IQ" | /*
> */ substr(cntrno,1,2)=="IS" | substr(cntrno,1,2)=="IT" |
> substr(cntrno,1,2)=="JO" | /*
> */ substr(cntrno,1,2)=="KE" | substr(cntrno,1,2)=="KW" |
> substr(cntrno,1,2)=="LB" | /*
> */ substr(cntrno,1,2)=="LR" | substr(cntrno,1,2)=="LS" |
> substr(cntrno,1,2)=="LT" | /*
> */ substr(cntrno,1,2)=="LU" | substr(cntrno,1,2)=="LV" |
> substr(cntrno,1,2)=="LY" | /*
> */ substr(cntrno,1,2)=="MA" | substr(cntrno,1,2)=="MC" |
> substr(cntrno,1,2)=="MD" | /*
> */ substr(cntrno,1,2)=="MG" | substr(cntrno,1,2)=="MK" |
> substr(cntrno,1,2)=="ML" | /*
> */ substr(cntrno,1,2)=="MR" | substr(cntrno,1,2)=="MT" |
> substr(cntrno,1,2)=="MW" | /*
> */ substr(cntrno,1,2)=="MZ" | substr(cntrno,1,2)=="NA" |
> substr(cntrno,1,2)=="NE" | /*
> */ substr(cntrno,1,2)=="NG" | substr(cntrno,1,2)=="NL" |
> substr(cntrno,1,2)=="NO" | /*
> */ substr(cntrno,1,2)=="PL" | substr(cntrno,1,2)=="PS" |
> substr(cntrno,1,2)=="PT" | /*
> */ substr(cntrno,1,2)=="QA" | substr(cntrno,1,2)=="RO" |
> substr(cntrno,1,2)=="RU" | /*
> */ substr(cntrno,1,2)=="RW" | substr(cntrno,1,2)=="SA" |
> substr(cntrno,1,2)=="SD" | /*
> */ substr(cntrno,1,2)=="SE" | substr(cntrno,1,2)=="SH" |
> substr(cntrno,1,2)=="SI" | /*
> */ substr(cntrno,1,2)=="SK" | substr(cntrno,1,2)=="SL" |
> substr(cntrno,1,2)=="SM" | /*
> */ substr(cntrno,1,2)=="SN" | substr(cntrno,1,2)=="SO" |
> substr(cntrno,1,2)=="SX" | /*
> */ substr(cntrno,1,2)=="SY" | substr(cntrno,1,2)=="SZ" |
> substr(cntrno,1,2)=="TD" | /*
> */ substr(cntrno,1,2)=="TG" | substr(cntrno,1,2)=="TN" |
> substr(cntrno,1,2)=="TR" | /*
> */ substr(cntrno,1,2)=="TZ" | substr(cntrno,1,2)=="UA" |
> substr(cntrno,1,2)=="UG" | /*
> */ substr(cntrno,1,2)=="YE" | substr(cntrno,1,2)=="ZA" |
> substr(cntrno,1,2)=="ZM" | /*
> */ substr(cntrno,1,2)=="ZM"
>         }
>
>
> *
> * 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/
>
>
> *
> * 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/
 		 	   		  
_________________________________________________________________
http://clk.atdmt.com/UKM/go/197222280/direct/01/
We want to hear all your funny, exciting and crazy Hotmail stories. Tell us now
*
*   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/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index