From | Arnold Kester <[email protected]> |
To | [email protected] |
Subject | Re: st: list long string variables in Stata8.2 SE |
Date | Sat, 28 Feb 2004 21:53:36 +0100 |
Arnold Kester wrote:
Dear listers,Alas, no answers, so I wrote something myself. It's rather crude I'm afraid, but maybe useful for someone else, too. I appended it here.
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?
© Copyright 1996–2024 StataCorp LLC | Terms of use | Privacy | Contact us | What's new | Site index |