Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: Field Widths and Delimiters


From   "Austin Nichols" <[email protected]>
To   [email protected]
Subject   Re: st: Field Widths and Delimiters
Date   Thu, 8 Jan 2009 13:37:50 -0500

Prashant Shukla <[email protected]>:
See -help missing-
(numeric variables can have a variety of missing value codes that you
presumably want to replace with blank spaces).

On Thu, Jan 8, 2009 at 1:23 PM, Prashant Shukla
<[email protected]> wrote:
> Thanks a Mil Austin. I think I would go with the latter option as the
> project is time sensitive. As I start the process, I have one question:
> What do you mean by numeric missings? I just want to make sure I
> understand everything before I start. Thanks so much,
>
> -Prash.
>
> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]] On Behalf Of Austin
> Nichols
> Sent: Thursday, January 08, 2009 11:32 AM
> To: [email protected]
> Subject: Re: st: Field Widths and Delimiters
>
> Prashant Shukla <[email protected]>:
> The -file- command can write whatever you want it to, assuming you are
> willing to learn how to use it (the -outfixt- code on SSC is one
> example, not too long to read through).  Another way to go is to turn
> every variable into a string variable of the right length (help
> tostring), with the format and justification you prefer, replacing
> numeric missings with spaces as appropriate, then append the single
> character "|" to the end of each (except the last var in the list),
> and then use -outfile- with the option -runtogether- to write your
> file.
>
> On Thu, Jan 8, 2009 at 12:01 PM, Prashant Shukla
> <[email protected]> wrote:
>> Hi All,
>>
>> Some time back, I had used -outfixt- by Austin Nichols to perfectly
>> export fixed width files as txt.
>>
>> Now, I don't need to export my data set as a fixed width file but it
>> needs to be "|" (pipe) delimited and the blank fields, if formatted as
>> %10s need to be 10 in length. In addition, if a field is formatted as
> 10
>> spaces long and only 8 of the designated spaces are being used, it
> still
>> needs to be exported with 10 as its width.
>>
>> While getting the file to be pipe delimited is not a problem, I am
>> struggling to keep the designated widths of the field in the txt
>> exports. Stata reduces the width of a field: a field formatted %10S
> only
>> occupies 8 spaces in the txt file if that's how long the elements of
> the
>> field are. But I need it to be 10 in length, which is when -outfixt-
>> came to mind. But, -outfixt- does not have a delimited option
> available.
>> Is there a way to use -outfixt- with a delimited or any other way in
>> Stata to keep the length of fields in txt exports as you specified and
>> formatted in Stata? Please provide some insight.
>>
>> Lastly, the blank fields are populated by dots. Is there a way to make
>> the blank fields be populated by a space? One space when the field is
> 1
>> in length and 5 when it is 5. Thanks so much in advance everyone.
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



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