Statalist


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

Re: st: RE: SSC Archive help files now available in HTML


From   Stas Kolenikov <[email protected]>
To   [email protected]
Subject   Re: st: RE: SSC Archive help files now available in HTML
Date   Sun, 29 Mar 2009 12:08:21 -0500

On Sun, Mar 29, 2009 at 10:14 AM, Kit Baum <[email protected]> wrote:
> Here is a Mata function that converts all .hlp and .sthlp in the current
> working directory:
>
> -----------------
> version 10.1
> mata:
> void function genhlpfiles()
> {
>        helpfiles = dir(".","files","*.*hlp")
>        if (rows(helpfiles) > 0) {
>            helpnames = substr(helpfiles, 1, (strpos(helpfiles,".") :- 1))
>        for(i=1; i<=rows(helpfiles); i++) {
>        cmd = "log html "+helpfiles[i]+" "+helpnames[i]+".html, replace"
>        cmd
>        stata(cmd)
>        }
>    }
> }
> end

Kit, any particular reason you did this Mata way as opposed to ado-way?

local helpfiles : dir "." files "*.*hlp"
local nf : word count `helpfiles'
forvalues k=1/`nf' {
   local thisfile : word `k' of `helpfiles'
   tokenize `thisfile', parse(".")
   di as inp ". log html `1'.`3' `1'.html"
   log html `1'.`3' `1'.html
}

probably does the same. Since that is compiled code, Mata will
probably be faster, but I imagine that the read/write operations are
the slowest ones, anyway.

-- 
Stas Kolenikov, also found at http://stas.kolenikov.name
Small print: I use this email account for mailing lists only.

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