Statalist


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

RE: st: RE: saving local macros


From   Greg Combs <[email protected]>
To   [email protected]
Subject   RE: st: RE: saving local macros
Date   Wed, 14 Jan 2009 10:47:05 -0600

Thanks to the 244 character limit in Stata, I'm running into some  
difficulty while working on very long strings.

I'm wondering if there's ever been any effort to write some string  
wrapper functions for notes/characteristics, since they don't have  
this byte limitation.

Direct programatic access to characteristics, I suppose is a  
prerequisite.  But I could see myself using this two-fold...

1. move some lengthy string data over to chars in order to use  
characteristics as a working bin, do string operations, greps,  
appends, and parsing on long data in characteristics without any fear  
of going beyond the 244 character limit.  Then, in a few  
circumstances, my final parsed data would be less than 244 characters  
long, so move it back into strings for analysis.

2. In some other cases, some data will always be longer than 244  
characters ... For instance, the executive summary of a state  
legislative bill will generally be around 350 characters.  If my bill  
represents a variable column in my data set, and legislators as each  
observation, I could drop the summary in as a note for that variable  
column.  Currently I have to do this in clunky fashion.  Once I've  
parsed out the summaries, I write them out to a temporary do file with  
appropriate 'notes' commands prepended.  Then I run the temp do file  
to actually create the notes.  If I had programatic access to reading  
and writing notes, I could significantly simplify this process.

Maarten's information about pulling out the note as a local macro  
seems to be a good first step here ...

	`_dta[note1]'

But I'd love to know if anyone's considered or started a library to  
have things like index, subinstr, regexr, regexm, word, itrim, substr  
operations on notes/characteristics or other lengthy data containers.

Alternatively, if the kind folks at Stata want to give us a bigger  
character limit for strings in Version 11, I certainly wouldn't  
complain.

Greg Combs



> Date: Wed, 7 Jan 2009 16:09:24 +0000 (GMT)
> From: Maarten buis <[email protected]>
> Subject: Re: st: saving local macros
>
> - --- Ashim Kapoor <[email protected]> wrote:
> > I understand the part where I can add notes. How do I recover a note
> > and put it in a local macro ?
>
> *----------- begin example -------------
> sysuse auto, clear
>
> // display the notes
> notes
>
> // access the notes as a local macro
> // called `_dta[note1]'
> di "`_dta[note1]'"
> *------------ end example --------------
>
> - -notes- appears to be a front end for -char- (see: -help char-)
>
> Hope this helps,
> Maarten
>
> - -----------------------------------------
> Maarten L. Buis
> Department of Social Research Methodology
> Vrije Universiteit Amsterdam
> Boelelaan 1081
> 1081 HV Amsterdam
> The Netherlands
>
> visiting address:
> Buitenveldertselaan 3 (Metropolitan), room N515
>
> +31 20 5986715
>
> http://home.fsw.vu.nl/m.buis/
> - -----------------------------------------
>
>
>
> *
> *   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index