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