Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

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

Re: st: text file line-end characters in mixed linux /os X / windows environments

From   Phil Schumm <[email protected]>
To   [email protected]
Subject   Re: st: text file line-end characters in mixed linux /os X / windows environments
Date   Sat, 1 Jan 2011 09:36:28 -0600

On Dec 31, 2010, at 5:01 PM, Kevin Geraghty wrote:
The issue is when jobs are run on linux or os X hosts, the text log files use the unix line-end conventions which is just an ASCII line feed as opposed to an ASCII carriage return-line feed pair which is what windows expects. People opening these files from windows machines using standard windows text editor programs see everything on one line.

On Jan 1, 2011, at 4:39 AM, Nick Cox wrote:
How does the Viewer in Windows Stata work with logs generated on other platforms?

I believe Stata's Viewer transparently handles files of all 3 flavors (<lf>,<cr> and <cr-lf>) on all platforms (this is certainly the case for <lf> and <cf-lf> under Windows and OS X). Since the Viewer is capable of handling large files, and since it provides some coloring for SMCL logs (e.g., input, errors, results, etc.), this is one of your best strategies for viewing Stata logs in an environment that includes both Windows and Unix/Linux/OS X machines.

How does Stata's do-file editor -doedit- work?

Stata's do-file editor also appears to handle line-endings transparently -- that is, under Windows it will open a do-file with <lf> endings, and under OS X it will open a file with <cr-lf> endings (I presume the same is true under Linux). Unfortunately however, editing the file under these circumstances then results in a file with mixed line endings (i.e., both <lf> and <cf-lf>), and this can cause problems in other circumstances (IMHO, Stata's do-file editor should not do this, but should use the native line endings of the file being edited, perhaps also offering an option to convert all line endings in the file to those of the current platform).

Since log files can grow fairly large, and since some text editors aren't very efficient with large files, I would definitely suggest using Stata's Viewer for viewing log files -- especially if they are in SMCL format. However, if you want to edit them and/or collaborate in writing do-files, then your best bet is to install a good text editor on the Windows machines (there have been several suggestions for specific editors made on this list in the past).

-- Phil

*   For searches and help try:

© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index