Statalist The Stata Listserver

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

Re: st: RE: Outputting formatted data to file

From   Steffen Hokland <hokland@MR.AU.DK>
Subject   Re: st: RE: Outputting formatted data to file
Date   Mon, 9 Oct 2006 12:28:46 +0200

Why do you call it extremely unaesthetic?
Having to convert a real to a string to convert that back to real in order to format the output seems a bit unelegant if not even unaesthetic. I'd 'prefer' if you wish to just:

write file foo_handle %9.5g `a_real_parameter'


write file foo_handle %10s `a_string'

but yes I agree that 'if it works don't fix it'.



Steffen Hokland

I'm trying to output some results to a file in formatted style.

However, it seems the only way to do this straight away is to use
binary in stead of ascii. My working but extreemly unaesthetical
solution has been this:

for strings:
file write slope_values %20s (trim("Intercept +OXi"))

for scalars:
file write slope_values %20.3f (real(string(`intercept_wOXi')))

There has to be a better way. I've been able to dig up something
about a function called 'macval()', but I haven't been able to find
anything about it in the help files (search and help doesn't turn up
*   For searches and help try:
Steffen Lund Hokland, MSc.
PhD Student

The MR-Research Centre
Institute of Clinical Medicine
Aarhus University Hospital
Skejby Hospital
DK-8200 Aarhus

Phone Office    :     +45 89495264
Phone Home    :    +45 48414828
Phone Mobile    :    +45 61307461

e-mail        :

*   For searches and help try:

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