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

RE: st: Hiding contents of a do-file

From   "Nick Cox" <>
To   <>
Subject   RE: st: Hiding contents of a do-file
Date   Mon, 1 Feb 2010 19:46:50 -0000

In essence, when you define your Mata function the calls to local macro
`i' are dereferenced to empty strings if only because the local macro
does not exist at that point. So, the macros have no effect. 

More generally, Mata as such has no notion of Stata macros. 

I am not in your (apparently delicate) situation but I am bemused by the
effort here in hiding a fairly basic line of code. 

I am obliquely reminded of a case in which I wrote a program for a
colleague and left him with the code. He rang a couple of hours later to
say that it no longer worked. He had made four small changes, two of
which were utterly fatal. The principle for what it's worth is that
there is a big difference between looking at the code and understanding
roughly what it does and being able to make the programmer redundant. 


Rasika Raghavan

This would be the way I created

string scalar encode(string scalar pt)

string scalar decode(string scalar et)

encode ("replace score = rss*coeff_rss_`i'[1] +
db_tb*coeff_db_tb_`i'[1] +remw*coeff_remw_`i'[1] +
maxp*coeff_maxp_`i'[1] +d_fifty*coeff_d_fifty_`i'[1] if overno==`i'")
mata mosave decode,replace

void one()

mata mosave one,replace

This is the error that I am getting,

coeff_rss_ ambiguous abbreviation
                 stata():  3598  Stata returned error
                   one():     -  function returned error
                 <istmt>:     -  function returned error

And yes, I want the user to be just able to see the output generated
and not the way it was generated. If I send them the full do-file,
then they are free to do their own analysis, and which would leave me
redundant. Certain issues prevent me from running the do-file myself
and sending across just the output.

*   For searches and help try:

© Copyright 1996–2020 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index