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

From |
"McCrary, Joseph" <Joseph.McCrary@ed.gov> |

To |
<statalist@hsphsun2.harvard.edu> |

Subject |
st: RE: length(s) question |

Date |
Mon, 25 Oct 2004 16:54:34 -0400 |

Don't use long as the name of the variable that you're using. Long is a variable type, so STATA is looking for a valid variable name. . gen long=length( district_name) too few variables specified r(102); . gen str long=length( district_name) too few variables specified r(102); . gen xxyy=length( district_name) . tab xxyy xxyy | Freq. Percent Cum. ------------+----------------------------------- 0 | 8 0.15 0.15 2 | 1 0.02 0.17 3 | 10 0.19 0.36 4 | 21 0.40 0.76 5 | 48 0.91 1.67 6 | 112 2.13 3.80 7 | 138 2.62 6.42 8 | 124 2.36 8.78 9 | 151 2.87 11.65 10 | 216 4.10 15.75 11 | 347 6.59 22.34 12 | 223 4.24 26.58 13 | 237 4.50 31.08 14 | 267 5.07 36.16 15 | 220 4.18 40.34 16 | 137 2.60 42.94 17 | 142 2.70 45.64 18 | 83 1.58 47.22 19 | 135 2.57 49.78 20 | 141 2.68 52.46 21 | 197 3.74 56.20 -----Original Message----- From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu]On Behalf Of Julia A. Gamas Sent: Monday, October 25, 2004 4:48 PM To: statalist@hsphsun2.harvard.edu Subject: st: length(s) question Dear all, I am trying to determine the length of a string variable because this length changes in each observation and I want to work with substr, so I need the variable to be the same size accross observations. But I'm getting an error message that I simply don't understand how to fix. I write: generate long = length (vp40_11), vp40_11 is the string varible whose length I want. Error message reads: "too few variables specification","r(102)" However, the help section says to write "generate varname = exp" and exp in this case is length (s), where "s" is the string variable. So I can't really understand which variable is missing. Can anybody help me out? Thanks, Julia Julia A. Gamas Program on Urban, Regional and Global Air Pollution Massachusetts Institute of Technology 77 Massachusetts Avenue 54-1823 Cambridge, MA 02139 Phone: 617-258-0230 Email: jgamas@mit.edu * * 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/ * * 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/

- Prev by Date:
**st: RE: length(s) question** - Next by Date:
**st: RE: RE: length(s) question** - Previous by thread:
**st: RE: length(s) question** - Next by thread:
**st: RE: RE: length(s) question** - Index(es):

© Copyright 1996–2015 StataCorp LP | Terms of use | Privacy | Contact us | What's new | Site index |