Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: list long string variables in Stata8.2 SE


From   Arnold Kester <arnold.kester@stat.unimaas.nl>
To   statalist <statalist@hsphsun2.harvard.edu>
Subject   st: list long string variables in Stata8.2 SE
Date   Mon, 09 Feb 2004 15:29:56 +0100

Dear listers,

I have several string variables of up to 244 chars length (stata-se). I often want to list these for a selection of the subjects and print a list of the patient identification nr (patnr) and the string var if that's not empty.

format stringvar %-244s
list patnr stringvar if stringvar~="", noobs notrim

does the trick. The format statement is to get left-aligned output, which already improves it a lot. An annoying point is that all string will be filled with blanks to the length of the longest string, wasting a lot of screen area/paper, and hampering readability.

My log file illustrates:
(this gets messed-up even more in the mail, sorry for that)
-------------------------------------------------------------------------------
> ----
log: /home/arnold/longstringdata.log
log type: text
opened on: 9 Feb 2004, 15:17:53

. insheet using longstringdata, delim(" ") clear
(2 vars, 3 obs)

. format stringvar %-244s

. list, notrim noobs

patnr stringvar
>
>
1 This is a long string, that is, it is fairly long, but not extremel
> y so
>
2 Ths s a shorty
>
>
3 This is really really really a very very very very very very long l
> ong
> long long long long long Long LOng LONG string

. log close
log: /home/arnold/longstringdata.log
log type: text
closed on: 9 Feb 2004, 15:18:23
-------------------------------------------------------------------------------
> ----

What I would like is this format for the list:

--------------------------------------------------
. list, notrim noobs really_nice_print

> patnr stringvar
1 This is a long string, that is, it is fairly long, but not
extremely so
2 Ths s a shorty
3 This is really really really a very very very very very very
long long long long long long long Long LOng LONG string
.
-----------------------------------------------------

Is this at all possible in Stata? Or should try and do it in latex?

Regards,
Arnold Kester

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