Statalist


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

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


From   [email protected]
To   [email protected]
Subject   st: How to output results of a program in single-spaced text
Date   Fri, 26 Oct 2007 20:43:31 -0300 (BRT)

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 |}"
}
------------------------------------------------

The results will look like more or less like this:

                           Princess |

                               John |

                               Paul |

                               Bush |

                            Clinton |

                            Michael |

                             Gordon |

                               Tony |

                               Lula |

                             Castro |



*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index