Hi All!
in general this is called a "number as text" or "number to text"
problem and after a google search, one gets tonns of links. E.g. the
following c++ source code deals with numbers up to vigintillions (if
your teams become REALLY large :)
http://read.pudn.com/downloads83/sourcecode/windows/320803/NumToText.cpp__.htm
Best regards, Sergiy
On Fri, Jan 9, 2009 at 1:58 PM, Jan Sauermann <[email protected]> wrote:
> Thanks a lot for your help!
>
> In my case, the solution by David Elliott is the most efficient one.
> My local storing the information I need is called "numaverageteamsize"
> (taken from -tab team-). The code looks like that:
>
> tab team
> local numaverageteamsize = r(r)
> local numaverageteamsize = "`:word `numaverageteamsize' of one two
> three four five six seven eight nine ten eleven twelve thirteen
> fourteen fifteen'"
>
> The string can then easily be exported to a tex-document using file
> open / file write / file close.
>
>
> Jan Sauermann
>
> Jan Sauermann
> +31.43.38.83801 (office) +31.6.55853921 (gsm) jan.sauermann (skype)
>
>
>
> On Fri, Jan 9, 2009 at 5:11 PM, Nick Cox <[email protected]> wrote:
>> There are several ways it can be done. For example, with a macro foo that is numeric we could do this:
>>
>> local words "one two three four five six seven eight nine ten"
>> local bar "`foo'"
>>
>> forval i = 1/10 {
>> if "`foo'" == "`i'" local bar : word `i' of words
>> }
>>
>> di "`bar'"
>>
>> You could use similar logic with a variable. Clearly you would to use a string variable as result.
>>
>> Alternatively, define value labels.
>>
>> Alternatively, use -subinstr()-.
>>
>> Nick
>> [email protected]
>>
>> Jan Sauermann
>>
>> I use Stata to store certain numbers in text-files in order to include
>> these in the text of my Latex-file (which is pretty handy, by the
>> way).
>>
>> Some numbers (integers only) are pretty small, say 2. Is there a way
>> to convert a number "2" into a string with content "two" in 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/
>>
> *
> * 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/