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]

st: RE: Expression too long


From   "Martin Weiss" <[email protected]>
To   <[email protected]>
Subject   st: RE: Expression too long
Date   Sun, 11 Apr 2010 18:02:42 +0200

<>

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


HTH
Martin

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of keeler james
Sent: Sonntag, 11. April 2010 17:52
To: [email protected]
Subject: st: Expression too long

Dear Statalist,

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"
        }
 		 	   		  
_________________________________________________________________
http://clk.atdmt.com/UKM/go/197222280/direct/01/
Do you have a story that started on Hotmail? 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/


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