Statalist


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

SV: st: return local limitation to 244 characters


From   "Kim Lyngby Mikkelsen (KLM)" <KLM@arbejdsmiljoforskning.dk>
To   <statalist@hsphsun2.harvard.edu>
Subject   SV: st: return local limitation to 244 characters
Date   Wed, 21 Nov 2007 15:28:01 +0100

Richard Williams asks:
You don't show how `cr' was created in the first place.  Did it ever 
contain more than 244 characters?


Yes, the ´cr' is build up through a series of foreach loops, and at the end of the loops, `cr' contains 1043 characters.

My complete code is:
___________________________________________________________________
*! 1.0.0 KLM 18 Nov 2007
program define longgraph, rclass
	version 10
	/* LONGGRAPH is inspired by 'longplot' (ZW & NJC 2001), but 	compared to longplot, LONGGRAPH is rudimentary and simple 	(although to the best of my current programming ability). Feel 	free to improve it! 	*/
	*
	/* like "longplot", LONGGRAPH graph values of a response variable 	yvar against a time variable xvar by groupvar such that each 	group is shown by a distinct connected line with different 	colors.
	LONGGRAPH uses the valuelabels of groupvar for legend.
	LONGGRAPH alaws for parsing of twoway_options such as title and 	axis using the graphopt(string) option.
	Connect_options and axis_choice_options is NOT possible! However, 	the complete command can be displayed on the screen using the des 	option for further manual elaboration. */

syntax varlist(min=2 max=2 numeric) [if/], BY(varname) GRaphopt(string) [dis]

qui levelsof `by', local(levels)
local N: word count `levels'
local if = "& `if'"
local cr
foreach l of local levels {
if `l'<`N' {
local cr  `cr'  line `varlist' if `by'==`l' `if', legend(lab(`l' `: label (`by') `l' ' )) ||
}
else {
local cr  `cr'  line `varlist' if `by'==`l' `if', legend(lab(`l' `: label (`by') `l' ' )) ||, `graphopt'
}
}
twoway `cr'
*if "`dis'" !="" {
*di "`cr'"
*}
return local lg `"`cr'"'

end
________________________________________________________________


Kim Lyngby Mikkelsen
Seniorforsker
Arbejdsulykker og Sikkerhed
Det Nationale Forskningscenter for Arbejdsmiljø
 
-----Oprindelig meddelelse-----
Fra: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] På vegne af Richard Williams
Sendt: 21. november 2007 15:13
Til: statalist@hsphsun2.harvard.edu; statalist@hsphsun2.harvard.edu
Emne: Re: st: return local limitation to 244 characters

At 09:06 AM 11/21/2007, Kim Lyngby Mikkelsen (KLM) wrote:
>A part of my code is given below.
>____________________________________________________________________________________
>*! 1.0.0 KLM 18 Nov 2007
>program define longgraph, rclass
>         version 10
>.
>.
>my code
>.
>.
>twoway `cr'
>return local lg `"`cr'"'
>
>end

You don't show how `cr' was created in the first place.  Did it ever 
contain more than 244 characters?


-------------------------------------------
Richard Williams, Notre Dame Dept of Sociology
OFFICE: (574)631-6668, (574)631-6463
HOME:   (574)289-5227
EMAIL:  Richard.A.Williams.5@ND.Edu
WWW:    http://www.nd.edu/~rwilliam

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



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