Statalist The Stata Listserver


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

st: RE: RE: RE: stcmd on Stata for Mac OS X?


From   "Newson, Roger B" <r.newson@imperial.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: RE: RE: stcmd on Stata for Mac OS X?
Date   Thu, 22 Jun 2006 19:46:32 +0100

As it happens, portability between operating environments has always
been a problem with -stcmd-. The version of -stcmd.ado- distributed on
SSC contains a prominent comment, specifically instructing users to edit
their own copies if necessary. This was felt to be preferable to making
users edit innumerable Stata do-files containing -stcmd2- commands every
time they change operating environments. The version of -stcmd.ado-
distributed on SSC reads as follows:

**** BEGINNING OF stcmd.ado - CUT HERE
#delim ;
prog def stcmd;
version 6.0;
*
 Run the Stat/Transfer st command
 with parameters and switches supplied by the user.
 Author: Roger Newson
 Date: 21 November 2000
*;

************************************************************************
********
 IMPORTANT TECHNICAL NOTE: SETTING THE LOCAL MACRO path
 stcmd, inputst and outputst will only work if Stat/Transfer is
installed on
 the user's system, and the path for the Stat/Transfer st command on the
user's
 system is the same as the setting of the local macro path in the user's
copy
 of stcmd.ado. In the distributed version of stcmd.ado, the macro path
is set
 to st. This means that stcmd will only call Stat/Transfer if the
directory in
 which Stat/Transfer is installed on the user's system is on the user's
default
 path (or is the current directory). If the Stat/Transfer directory is
not on
 the user's default path, then the user must edit his/her copy of
stcmd.ado and
 change the setting of the local macro path so as to specify the path of
the
 Stat/Transfer st command on the user's system. For instance, if
Stat/Transfer
 is installed in the directory c:\Program Files\StatTransfer5, then the
user
 must edit stcmd.ado and alter the command
 local path "st"
 to
 local path "c:\Program Files\StatTransfer5\st"
************************************************************************
********
;
local path "st";

* Run program *;
if("$S_OS"=="Windows"){
  *
   Path is very likely to contain spaces
   and should therefore be quoted
  *;
  shell "`path'" `0';
};
else{
  *
   OS is Unix/Linux,
   so path should not contain spaces
  *;
  shell `path' `0';
};

end;
**** END OF stcmd.ado - CUT HERE

Pierre Azoulay appears to have started with the version distributed by
StatTransfer for Windows users, which StatTransfer have modified from my
original version (with my approval) to use the path in which
StatTransfer is installed, as specified by the user to the StatTransfer
installation wizard. I do not know whether the StatTransfer installation
wizard offers -stcmd- to MacOS and/or Unix/Linux users. Ideally, it
would do so.

In this particular case, I would argue that the problems caused by
multiple user-specified versions of -stcmd.ado- are less than the
problems caused by the alternatives, which would presumably lead to
multiple user-specified versions of -stcmd2.ado-, -stcmd3.ado- etc.
However, Nick's advice (and the advice in the FAQ) makes sense for the
vast majority of unofficial Stata programs.

I hope this helps. Thanks for reminding me that I am overdue for a
Stat/Transfer upgrade.

Roger


Roger Newson
Lecturer in Medical Statistics
TELEPHONE: (+44) 020 7594 0939
FAX: (+44) 020 7594 0942
EMAIL: r.newson@imperial.ac.uk
WEBSITE: http://www.imperial.ac.uk/nhli/r.newson/
POSTAL ADDRESS:
Respiratory Epidemiology and Public Health Group
National Heart and Lung Institute at Imperial College London
St Mary's Campus
Norfolk Place
London W2 1PG
STREET ADDRESS:
Respiratory Epidemiology and Public Health Group
National Heart and Lung Institute at Imperial College London
47 Praed Street
Paddington
London W1 1NR

SOON moving again to:
National Heart and Lung Institute at Imperial College London
Emmanuel Kaye Building
Manresa Road
London SW3 6LR

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


-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Nick Cox
Sent: 22 June 2006 08:54
To: statalist@hsphsun2.harvard.edu
Subject: st: RE: RE: stcmd on Stata for Mac OS X?

Glad you solved your problem. However, 
the program you have now is no longer -stcmd-
as written by Roger Newson. 

Even if you only use it privately, you should change 
the name. But already you are already implying
that others in your situation should change the 
program. That is good advice, but only if they 
also change the program name. 

This is good practice because of the possibility
that sometime in the future you will ask 
for support on -stcmd- and you and everybody 
else will be talking about different programs. 
At worst, you will be asking for support on 
a bug you introduced yourself and which will
be hard to identify. Or, others may ask Roger
for support on a program he didn't write. 

Reminding yourself every time you use it that you 
changed the program thus does no harm and may 
do some good by reducing communication problems 
in the future. 

The point may seem minor in this example, but 
I am making a fuss about it because it applies
much more generally. 

The advice is already given in the FAQ

6.4 What is the relationship between ado-files from the 
SSC Archive, other user-written ados, ados published 
in the Stata Journal, and ados that are part of official Stata?

...

... while anything placed in the SSC Archive is tacitly put 
in the public domain. In practice, you can probably take anything 
published [there] and modify it as you will -- especially if you 
do that privately -- but publicly we recommend that unless you are 
the original author, you should change the name of the program, 
take all blame for any limitations your changes produce, and 
imply that a suitably large portion of the credit for the 
program belongs to the original authors. 

Nick 
n.j.cox@durham.ac.uk 

Pierre Azoulay
 
> Thanks to Nick for his post. I thnk I answered my own question, but my
> hack might be useful to other Mac Users. As it turns out, the
> stcmd.ado installed by the PC version of stat/transfer can easily be
> modified to work on a mac. Here is the program:
> --------------------------
> #delim ;
> prog def stcmd;
> version 6.0;
> *
>  Run the Stat/Transfer st command
>  with parameters and switches supplied by the user.
>  Author: Roger Newson
>  Date: 12 November 2000
> *;
> 
> *shell "C:\Program Files\StatTransfer8\st" `0' ;
> shell /Applications/StatTransfer/st.command `0' ;
> 
> end;
> ---------------------------
> 
> The only thing to note is that statements like
> 
> stcmd essai.xls stata/se essai.dta /y /t
> 
> will need to be modified to read:
> 
> stcmd essai.xls stata/se essai.dta -y -t
> 
> 
> The ability to Stat/Transfer files from within stata is certainly
> convenient. Once you start relying on it, it will be hard to give up!

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   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