Statalist


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

st: Confirming paths and/or whether shell executed OK


From   "Newson, Roger B" <r.newson@imperial.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: Confirming paths and/or whether shell executed OK
Date   Tue, 5 Aug 2008 14:51:21 +0100

I have some queries about calling non-Stata programs (eg Stat/Transfer)
from within Stata:

1. Is there a way of verifying that a string (eg the contents of a
macro) is a program path name, under the operating environment under
which Stata is currently running? I am aware that we can use

confirm file <filename>

to confirm or deny that <filename> is the name of an existing file.
However, a filename is not exactly the same thing as a program path
name. For instance, under Windows, a program path name can be a program
filename minus the .exe or .bat extension, and such a pathname will not
pass as a filename, according to the confirm command.

2. Failing that, is there a way for Stata to know, and to pass to the
user's program, information on whether a program run by the shell
command executed successfully? (Preferably passing the return code
returned by the operating enviromment.) The shell command does not
appear to return anything in r(), s() or even e().

3. If either of these things are currently impossible in Stata, then are
there plans to make them possible?

I ask because users of my SSC package stcmd (which calls Stat/Transfer)
are often confused if Stat/Transfer does not run correctly. In the next
update of stcmd, I would like to make stcmd more helpful to such users,
giving advice on what may have gone wrong. Currently, the best that I
can think of is to make stcmd echo the Stat/Transfer command that it
passes to the operating environment. However, that would be helpful
mostly to technically-minded users, who know a bit about commands and
the operating environment. A lot of users do not like having to
understand commands of the kind executed in shell scripts.

Best wishes (and thanks in advance)

Roger


Roger B Newson
Lecturer in Medical Statistics
Respiratory Epidemiology and Public Health Group
National Heart and Lung Institute
Imperial College London
Royal Brompton Campus
Room 33, Emmanuel Kaye Building
1B Manresa Road
London SW3 6LR
UNITED KINGDOM
Tel: +44 (0)20 7352 8121 ext 3381
Fax: +44 (0)20 7351 8322
Email: r.newson@imperial.ac.uk 
Web page: www.imperial.ac.uk/nhli/r.newson/
Departmental Web page:
http://www1.imperial.ac.uk/medicine/about/divisions/nhli/respiration/pop
genetics/reph/

Opinions expressed are those of the author, not of the institution.

*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index