Bookmark and Share

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


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

Re: st: Creating automatic log file when I start Stata in MAC


From   Sergiy Radyakin <[email protected]>
To   [email protected]
Subject   Re: st: Creating automatic log file when I start Stata in MAC
Date   Thu, 2 Dec 2010 17:02:48 -0500

Dear Donald,

While having no access to any snow leopards around,
may I humbly suggest that you remove the stars
which comment out the crucial parts of the program
and retry?

At least on my PC the program started showing the
query window after this change. Don't forget to adjust
the path as the program instructs.

Specifically, remove the stars in front of the "window"
and in front of the "capture"

Best, Sergiy Radyakin
Economist, The World Bank





On Thu, Dec 2, 2010 at 4:44 PM, Donald Spady <[email protected]> wrote:
> I am trying to modify a program called set_log_file.ado to put into my profile.do so as to prompt me to enter a filename for a logfile.  I am doing this for Stata 11 in MAC OS (snow leopard)
> When I try what is written below, it does not prompt me for a file name and just goes on to the end and then says "file/documents/statlogs/.log could not be opened.
> It is not my program, but I got it from somewhere many years ago and it worked OK on a PC.  Now I have a MAC and am having some teething problems.
>
> The program is as follows
>
> macro drop DB*
> capture program drop set_log_file
> program define set_log_file
>  version 7.0
>
> local x : display %dNDY date("$S_DATE","dmy") substr("$S_TIME",1,2) substr("$S_TIME",4,2)
> global DB_filename "Enter log file name:"
> *window control static DB_filename 10 10 100 10
> *window control edit 10 20 175 8 DB_fname
> *window control button "OK" 10 40 50 10 DB_ok default
> *window control button "Cancel" 70 40 50 10 DB_can escape
> global DB_ok "exit 3001"
> global DB_can "exit 3000"
>
> * change the 400 400 co-ordinates below to centre the dialog box on your own screen
> * if you want smcl output, just drop the +."log" part below
> * and change "basic.log" to "basic" (or any other name that suits)
> * capture noisily window dialog "Log file details"  400 400 200 70
> if _rc==3001 {
>  global DB_fname="$DB_fname.log"
>  }
>  else
> if _rc==3000 {
>    global DB_fname="basic.log"
>  }
> *add your own path statements on the following line
> global lfile="/documents/statalogs/"+"$DB_fname"
> log using $lfile, append
> *log using $DB_fname
> end
>
> The *window lines are commented out because the use of the word 'control' for some reason doesn't work
>
> Where am I going wrong.
>
> Many thanks
>
> Don Spady
>
> Nature bats last.
>
>
> *
> *   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/
>

*
*   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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index