Statalist The Stata Listserver


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

Re: st: Accessing the path and filename of currently open logfile.


From   Phil Schumm <[email protected]>
To   [email protected]
Subject   Re: st: Accessing the path and filename of currently open logfile.
Date   Tue, 30 May 2006 08:53:50 -0500

On May 30, 2006, at 7:49 AM, David Elliott wrote:
   gettoken nameonly extonly: logfile, parse(".")

This will not work if the filename has a period in it. Come from the other end, or, better yet, use a regular expression.



   local logstem "`logpath'""`nameonly'"

Presumably you want instead:

    local logstem "`logpath'`nameonly'"


The other question I have is whether there is a way for -syntax- to handle command lines in the form: -cmd1, options: cmd2, options- or is it always necessary to nibble the command line apart with gettoken, or at least to get the left and right halves into a form for syntax to handle. If not obvious already, I am trying to create a "wrapper" for another command(s). If one didn't want the wrapper command to have options, one could simply use -cmd1 cmd2,options- that could be parsed by syntax. It is the need to have the ",options" and the ":" separator following cmd1 that causes the difficulties.

This is, in general, not the way to wrap an existing command. The command you're wrapping shouldn't appear on the command line, and you should have only one call to -syntax-, using the * specifier to pass through any options to the existing command that you don't want to handle explicitly. If you gave some more details about what you are trying to do, we could provide a more detailed suggestion.


-- Phil

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