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

st: Left-aligned string variables

From   Friedrich Huebler <>
Subject   st: Left-aligned string variables
Date   Tue, 8 Feb 2005 14:37:42 -0800 (PST)

How does one left-align a string variable if one does not know the
length of the longest string? I read [U] 15.5 and the -format- entry
in the Reference Manual but cannot find an answer to my question.

Take for example the data in the -format- documentation. To
left-align the variable "state" I manually inspect the storage type
to identify the length and then change the display format.

. webuse census10
. d state
              storage  display     value
variable name   type   format      label      variable label
state           str14  %14s                   State
. format state %-14s

Can this step be automated? My data consists of several right-aligned
string variables of varying length and I would like all of them to be
left-aligned. The solution would work ideally in a case when the
variable names are not known.

Thank you,

Friedrich Huebler

Do you Yahoo!? 
Yahoo! Mail - 250MB free storage. Do more. Manage less.
*   For searches and help try:

© Copyright 1996–2017 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index