Statalist


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

Re: st: How to output results of a program in single-spaced text


From   "Scott Merryman" <scott.merryman@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: How to output results of a program in single-spaced text
Date   Fri, 26 Oct 2007 20:17:25 -0500

On 10/26/07, tiago.pereira@incor.usp.br <tiago.pereira@incor.usp.br> wrote:
> Dear all,
>
> I would like to know how to output a result of a program involving
> strings. Please, find an example below , in which the variable "person" is
> a string variable. The aim is to output these strings together with
> numeric data (not shown). However, my current approach only allows one to
> output data as a double-spaced text, whereas I wish to output data in a
> single-spaced text to save space. Furthermore, I could not figure out a
> solution searching  in manuals. If you have any tip, I will be very
> grateful for your help.
>
> Thanks to Maarten and Kit for their help on my old questions.
>
> All the best,
>
> Tiago
> -------------------------------------------------
> clear
> set obs 10
> input str20 person
> Princess Diana
> John
> Paul
> Bush Killīs Everybody
> Clinton
> Michael & Children
> Gordon Brown
> Tony Blair
> Lula
> Castro IsDa Man
> end
> local N = _N
> forvalues i = 1/`N' {
> local ID`i' = abbrev(person[`i'],10)
> }
>  forvalues i = 1/`N' {
> di in green _n _col(12)  %25s " `ID`i'' "  "{c |}"
> }


Remove the newline display directive,  "_n," in the -display- statement.

Scott

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