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: nl command - error#130 expression too long


From   Carlotta Schuster <[email protected]>
To   [email protected]
Subject   Re: st: nl command - error#130 expression too long
Date   Wed, 6 Feb 2013 10:51:28 +0100

Here is my whole code for the program (which fits the form of a function
evaluator program according to the help file for the nl command). After
the program I run the line I have at the end to call the program.
According to what I have read in the statalist this should work since
the function evaluator with the nl command should handle and arbitrarily
large number of variables. But I still get the #130 error of expression
too long.

Thanks.




program nlweight2, rclass

        version 11
        syntax varlist(min=1 max=300) if
        local istocks : word 1 of `varlist'
        local age_1 : word 2 of `varlist'
        local s2009 : word 3 of `varlist'
        local age_2 : word 4 of `varlist'
        local s2008 : word 5 of `varlist'
        local age_3 : word 6 of `varlist'
        local s2007 : word 7 of `varlist'
        local age_4 : word 8 of `varlist'
        local s2006 : word 9 of `varlist'
        local age_5 : word 10 of `varlist'
        local s2005 : word 11 of `varlist'
        local age_6 : word 12 of `varlist'
        local s2004 : word 13 of `varlist'
        local age_7 : word 14 of `varlist'
        local s2003 : word 15 of `varlist'
        local age_8 : word 16 of `varlist'
        local s2002 : word 17 of `varlist'
        local age_9 : word 18 of `varlist'
        local s2001 : word 19 of `varlist'
        local age_10 : word 20 of `varlist'
        local s2000 : word 21 of `varlist'
        local age_11 : word 22 of `varlist'
        local s1999 : word 23 of `varlist'
        local age_12 : word 24 of `varlist'
        local s1998 : word 25 of `varlist'
        local age_13 : word 26 of `varlist'
        local s1997 : word 27 of `varlist'
        local age_14 : word 28 of `varlist'
        local s1996 : word 29 of `varlist'
        local age_15 : word 30 of `varlist'
        local s1995 : word 31 of `varlist'
        local age_16 : word 32 of `varlist'
        local s1994 : word 33 of `varlist'
        local age_17 : word 34 of `varlist'
        local s1993 : word 35 of `varlist'
        local age_18 : word 36 of `varlist'
        local s1992 : word 37 of `varlist'
        local age_19 : word 38 of `varlist'
        local s1991 : word 39 of `varlist'
        local age_20 : word 40 of `varlist'
        local s1990 : word 41 of `varlist'
        local age_21 : word 42 of `varlist'
        local s1989 : word 43 of `varlist'
        local age_22 : word 44 of `varlist'
        local s1988 : word 45 of `varlist'
        local age_23 : word 46 of `varlist'
        local s1987 : word 47 of `varlist'
        local age_24 : word 48 of `varlist'
        local s1986 : word 49 of `varlist'
        local age_25 : word 50 of `varlist'
        local s1985 : word 51 of `varlist'
        local age_26 : word 52 of `varlist'
        local s1984 : word 53 of `varlist'
        local age_27 : word 54 of `varlist'
        local s1983 : word 55 of `varlist'
        local age_28 : word 56 of `varlist'
        local s1982 : word 57 of `varlist'
        local age_29 : word 58 of `varlist'
        local s1981 : word 59 of `varlist'
        local age_30 : word 60 of `varlist'
        local s1980 : word 61 of `varlist'
        local age_31 : word 62 of `varlist'
        local s1979 : word 63 of `varlist'
        local age_32 : word 64 of `varlist'
        local s1978 : word 65 of `varlist'
        local age_33 : word 66 of `varlist'
        local s1977 : word 67 of `varlist'
        local age_34 : word 68 of `varlist'
        local s1976 : word 69 of `varlist'
        local age_35 : word 70 of `varlist'
        local s1975 : word 71 of `varlist'
        local age_36 : word 72 of `varlist'
        local s1974 : word 73 of `varlist'
        local age_37 : word 74 of `varlist'
        local s1973 : word 75 of `varlist'
        local age_38 : word 76 of `varlist'
        local s1972 : word 77 of `varlist'
        local age_39 : word 78 of `varlist'
        local s1971 : word 79 of `varlist'
        local age_40 : word 80 of `varlist'
        local s1970 : word 81 of `varlist'
        local age_41 : word 82 of `varlist'
        local s1969 : word 83 of `varlist'
        local age_42 : word 84 of `varlist'
        local s1968 : word 85 of `varlist'
        local age_43 : word 86 of `varlist'
        local s1967 : word 87 of `varlist'
        local age_44 : word 88 of `varlist'
        local s1966 : word 89 of `varlist'
        local age_45 : word 90 of `varlist'
        local s1965 : word 91 of `varlist'
        local age_46 : word 92 of `varlist'
        local s1964 : word 93 of `varlist'
        local age_47 : word 94 of `varlist'
        local s1963 : word 95 of `varlist'
        local age_48 : word 96 of `varlist'
        local s1962 : word 97 of `varlist'
        local age_49 : word 98 of `varlist'
        local s1961 : word 99 of `varlist'
        local age_50 : word 100 of `varlist'
        local s1960 : word 101 of `varlist'
        local age_51 : word 102 of `varlist'
        local s1959 : word 103 of `varlist'
        local age_52 : word 104 of `varlist'
        local s1958 : word 105 of `varlist'
        local age_53 : word 106 of `varlist'
        local s1957 : word 107 of `varlist'
        local age_54 : word 108 of `varlist'
        local s1956 : word 109 of `varlist'
        local age_55 : word 110 of `varlist'
        local s1955 : word 111 of `varlist'
        local age_56 : word 112 of `varlist'
        local s1954 : word 113 of `varlist'
        local age_57 : word 114 of `varlist'
        local s1953 : word 115 of `varlist'
        local age_58 : word 116 of `varlist'
        local s1952 : word 117 of `varlist'
        local age_59 : word 118 of `varlist'
        local s1951 : word 119 of `varlist'
        local age_60 : word 120 of `varlist'
        local s1950 : word 121 of `varlist'
        local age_61 : word 122 of `varlist'
        local s1949 : word 123 of `varlist'
        local age_62 : word 124 of `varlist'
        local s1948 : word 125 of `varlist'
        local age_63 : word 126 of `varlist'
        local s1947 : word 127 of `varlist'
        local age_64 : word 128 of `varlist'
        local s1946 : word 129 of `varlist'
        local age_65 : word 130 of `varlist'
        local s1945 : word 131 of `varlist'
        local age_66 : word 132 of `varlist'
        local s1944 : word 133 of `varlist'
        local age_67 : word 134 of `varlist'
        local s1943 : word 135 of `varlist'
        local age_68 : word 136 of `varlist'
        local s1942 : word 137 of `varlist'
        local age_69 : word 138 of `varlist'
        local s1941 : word 139 of `varlist'
        local age_70 : word 140 of `varlist'
        local s1940 : word 141 of `varlist'
        local age_71 : word 142 of `varlist'
        local s1939 : word 143 of `varlist'
        local age_72 : word 144 of `varlist'
        local s1938 : word 145 of `varlist'
        local age_73 : word 146 of `varlist'
        local s1937 : word 147 of `varlist'
        local age_74 : word 148 of `varlist'
        local s1936 : word 149 of `varlist'
        local age_75 : word 150 of `varlist'
        local s1935 : word 151 of `varlist'
        local age_76 : word 152 of `varlist'
        local s1934 : word 153 of `varlist'
        local age_77 : word 154 of `varlist'
        local s1933 : word 155 of `varlist'
        local age_78 : word 156 of `varlist'
        local s1932 : word 157 of `varlist'
        local age_79 : word 158 of `varlist'
        local s1931 : word 159 of `varlist'
        local age_80 : word 160 of `varlist'
        local s1930 : word 161 of `varlist'
        local logincome : word 162 of `varlist'
        local logincomesq : word 163 of `varlist'
        local children : word 164 of `varlist'
        local childrensq : word 165 of `varlist'
        local logliquidassets : word 166 of `varlist'
        local logliquidassetssq : word 167 of `varlist'
        local retired : word 168 of `varlist'
        local college : word 169 of `varlist'
        local married : word 170 of `varlist'
        local financial_sector : word 171 of `varlist'
        local SMC_pc : word 172 of `varlist'
        local GPD_pc : word 173 of `varlist'
        local GDP_pc : word 174 of `varlist'
        local INF : word 175 of `varlist'
        local UNEMP : word 176 of `varlist'
        local PENS : word 177 of `varlist'

        return local eq "`istocks' = {A} +
{B}*((`age_1'^{lambda}*`s2009'+`age_2'^{lambda}*`s2008'+`age_3'^{lambda}
*`s2007'+`age_4'^{lambda}*`s2006'+`age_5'^{lambda}*`s2005'+`age_6'^{lamb
da}*`s2004'+`age_7'^{lambda}*`s2003'+`age_8'^{lambda}*`s2002'+`age_9'^{l
ambda}*`s2001'+`age_10'^{lambda}*`s2000'+`age_11'^{lambda}*`s1999'+`age_
12'^{lambda}*`s1998'+`age_13'^{lambda}*`s1997'+`age_14'^{lambda}*`s1996'
+`age_15'^{lambda}*`s1995'+`age_16'^{lambda}*`s1994'+`age_17'^{lambda}*`
s1993'+`age_18'^{lambda}*`s1992'+`age_19'^{lambda}*`s1991'+`age_20'^{lam
bda}*`s1990'+`age_21'^{lambda}*`s1989'+`age_22'^{lambda}*`s1988'+`age_23
'^{lambda}*`s1987'+`age_24'^{lambda}*`s1986'+`age_25'^{lambda}*`s1985'+`
age_26'^{lambda}*`s1984'+`age_27'^{lambda}*`s1983'+`age_28'^{lambda}*`s1
982'+`age_29'^{lambda}*`s1981'+`age_30'^{lambda}*`s1980'+`age_31'^{lambd
a}*`s1979'+`age_32'^{lambda}*`s1978'+`age_33'^{lambda}*`s1977'+`age_34'^
{lambda}*`s1976'+`age_35'^{lambda}*`s1975'+`age_36'^{lambda}*`s1974'+`ag
e_37'^{lambda}*`s1973'+`age_38'^{lambda}*`s1972'+`age_39'^{lambda}*`s197
1'+`age_40'^{lambda}*`s1970'+`age_41'^{lambda}*`s1969'+`age_42'^{lambda}
*`s1968'+`age_43'^{lambda}*`s1967'+`age_44'^{lambda}*`s1966'+`age_45'^{l
ambda}*`s1965'+`age_46'^{lambda}*`s1964'+`age_47'^{lambda}*`s1963'+`age_
48'^{lambda}*`s1962'+`age_49'^{lambda}*`s1961'+`age_50'^{lambda}*`s1960'
+`age_51'^{lambda}*`s1959'+`age_52'^{lambda}*`s1958'+`age_53'^{lambda}*`
s1957'+`age_54'^{lambda}*`s1956'+`age_55'^{lambda}*`s1955'+`age_56'^{lam
bda}*`s1954'+`age_57'^{lambda}*`s1953'+`age_58'^{lambda}*`s1952'+`age_59
'^{lambda}*`s1951'+`age_60'^{lambda}*`s1950'+`age_61'^{lambda}*`s1949'+`
age_62'^{lambda}*`s1948'+`age_63'^{lambda}*`s1947'+`age_64'^{lambda}*`s1
946'+`age_65'^{lambda}*`s1945'+`age_66'^{lambda}*`s1944'+`age_67'^{lambd
a}*`s1943'+`age_68'^{lambda}*`s1942'+`age_69'^{lambda}*`s1941'+`age_70'^
{lambda}*`s1940'+`age_71'^{lambda}*`s1939'+`age_72'^{lambda}*`s1938'+`ag
e_73'^{lambda}*`s1937'+`age_74'^{lambda}*`s1936'+`age_75'^{lambda}*`s193
5'+`age_76'^{lambda}*`s1934'+`age_77'^{lambda}*`s1933'+`age_78'^{lambda}
*`s1932'+`age_79'^{lambda}*`s1931'+`age_80'^{lambda}*`s1930')/(`age_1'^{
lambda}+`age_2'^{lambda}+`age_3'^{lambda}+`age_4'^{lambda}+`age_5'^{lamb
da}+`age_6'^{lambda}+`age_7'^{lambda}+`age_8'^{lambda}+`age_9'^{lambda}+
`age_10'^{lambda}+`age_11'^{lambda}+`age_12'^{lambda}+`age_13'^{lambda}+
`age_14'^{lambda}+`age_15'^{lambda}+`age_16'^{lambda}+`age_17'^{lambda}+
`age_18'^{lambda}+`age_19'^{lambda}+`age_20'^{lambda}+`age_21'^{lambda}+
`age_22'^{lambda}+`age_23'^{lambda}+`age_24'^{lambda}+`age_25'^{lambda}+
`age_26'^{lambda}+`age_27'^{lambda}+`age_28'^{lambda}+`age_29'^{lambda}+
`age_30'^{lambda}+`age_31'^{lambda}+`age_32'^{lambda}+`age_33'^{lambda}+
`age_34'^{lambda}+`age_35'^{lambda}+`age_36'^{lambda}+`age_37'^{lambda}+
`age_38'^{lambda}+`age_39'^{lambda}+`age_40'^{lambda}+`age_41'^{lambda}+
`age_42'^{lambda}+`age_43'^{lambda}+`age_44'^{lambda}+`age_45'^{lambda}+
`age_46'^{lambda}+`age_47'^{lambda}+`age_48'^{lambda}+`age_49'^{lambda}+
`age_50'^{lambda}+`age_51'^{lambda}+`age_52'^{lambda}+`age_53'^{lambda}+
`age_54'^{lambda}+`age_55'^{lambda}+`age_56'^{lambda}+`age_57'^{lambda}+
`age_58'^{lambda}+`age_59'^{lambda}+`age_60'^{lambda}+`age_61'^{lambda}+
`age_62'^{lambda}+`age_63'^{lambda}+`age_64'^{lambda}+`age_65'^{lambda}+
`age_66'^{lambda}+`age_67'^{lambda}+`age_68'^{lambda}+`age_69'^{lambda}+
`age_70'^{lambda}+`age_71'^{lambda}+`age_72'^{lambda}+`age_73'^{lambda}+
`age_74'^{lambda}+`age_75'^{lambda}+`age_76'^{lambda}+`age_77'^{lambda}+
`age_78'^{lambda}+`age_79'^{lambda}+`age_80'^{lambda}))+{C}*`logincome'+
{beta2}*`logincomesq'+{beta3}*`children'+{beta4}*`childrensq'+{beta5}*`l
ogliquidassets'+{beta6}*`logliquidassetssq'+{beta7}*`retired'+{beta8}*`c
ollege'+{beta9}*`married'+{beta10}*`financial_sector'+{beta11}*`SMC_pc'+
{beta12}*`GPD_pc'+{beta13}*`GDP_pc'+{beta14}*`INF'+{beta15}*`UNEMP'+{bet
a16}*`PENS'"


end




nl weight2 : istocks age_1 s2009 age_2 s2008 age_3 s2007 age_4 s2006
age_5 s2005 age_6 s2004 age_7 s2003 age_8 s2002 age_9 s2001 age_10 s2000
age_11 s1999 age_12 s1998 age_13 s1997 age_14 s1996 age_15 s1995 age_16
s1994 age_17 s1993 age_18 s1992 age_19 s1991 age_20 s1990 age_21 s1989
age_22 s1988 age_23 s1987 age_24 s1986 age_25 s1985 age_26 s1984 age_27
s1983 age_28 s1982 age_29 s1981 age_30 s1980 age_31 s1979 age_32 s1978
age_33 s1977 age_34 s1976 age_35 s1975 age_36 s1974 age_37 s1973 age_38
s1972 age_39 s1971 age_40 s1970 age_41 s1969 age_42 s1968 age_43 s1967
age_44 s1966 age_45 s1965 age_46 s1964 age_47 s1963 age_48 s1962 age_49
s1961 age_50 s1960 age_51 s1959 age_52 s1958 age_53 s1957 age_54 s1956
age_55 s1955 age_56 s1954 age_57 s1953 age_58 s1952 age_59 s1951 age_60
s1950 age_61 s1949 age_62 s1948 age_63 s1947 age_64 s1946 age_65 s1945
age_66 s1944 age_67 s1943 age_68 s1942 age_69 s1941 age_70 s1940 age_71
s1939 age_72 s1938 age_73 s1937 age_74 s1936 age_75 s1935 age_76 s1934
age_77 s1933 age_78 s1932 age_79 s1931 age_80 s1930 logincome
logincomesq children childrensq logliquidassets logliquidassetssq
retired college married financial_sector SMC_pc GPD_pc GDP_pc INF UNEMP
PENS, nolog;
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


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