Statalist


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

Re: st: RE: saving local macros


From   "Ashim Kapoor" <[email protected]>
To   [email protected]
Subject   Re: st: RE: saving local macros
Date   Wed, 7 Jan 2009 23:49:08 +0530

Hello again,

My apologies. I was referring to Jeff Herrin's code when I said " I
think this does it" Please give me some time to try it out.

Thank you,
Ashim.

On Wed, Jan 7, 2009 at 11:47 PM, Ashim Kapoor <[email protected]> wrote:
> Yes I think this does it. Give me some time to try it, I think this does it.
>
> Thank you,
> Ashim.
>
> On Wed, Jan 7, 2009 at 11:28 PM, Jeph Herrin <[email protected]> wrote:
>>
>> Here's a code which creates a do-file which will reassign all
>> the local macros. The only thing that needs to be fixed is that
>> it should have embedded quotes and as usual I can't seem to get
>> them right and I am off for lunch etc now.
>>
>> * ----------- for testing
>>
>> local test "This one"
>>
>> *------------- save locals ------------------
>> capture log close
>> log using mylocals.txt, text replace
>> macro list
>> log close
>> file open logfile using mylocals.txt, read
>> file open mylocals using mylocals.do, replace write
>> file read logfile line
>> while r(eof)==0 {
>>        local lname : word 1 of "`line'"
>>        if strpos("`lname'","_")==1 {
>>                local lval  : subinstr local line "`lname'" ""
>>                local lname : subinstr local lname "_" ""
>>                local lname : subinstr local lname ":" ""
>>                * next line should have embedded quotes for last token
>>                file write mylocals "local `lname' `lval'"  _n
>>        }
>>        file read logfile line
>> }
>> file close logfile
>> file close mylocals
>> *----------- done --------------------------
>>
>>
>> This creates a do-file called mylocals.do; if you run it,
>> it will reload all the local macros that you had when you
>> ran it.
>>
>> hope this helps,
>> Jeph
>>
>>
>>
>> Ashim Kapoor wrote:
>>>
>>> Hi Nick,
>>>
>>> I don't think I was clear. Here is what I do :
>>> 1. Run sometests and produce local macros and a small output dataset.
>>> 2. Use the macros and dataset to print the output.
>>>
>>> so (2) is ALL I want any1 to see. I am not worried about encrypting
>>> the local macros, only that I can't let anyone else see the do file i
>>> am running to produce my macro.
>>>
>>> Is'nt is much easier to save the macros / save the dataset and send it
>>> to someone to see the output whethere in HTML or smcl.
>>> Why risk someone decrypting my file ?
>>>
>>> It's not even my IDEA, I just program it but I don't think my boss
>>> will like it if i put it on the internet.
>>>
>>> Is'nt everyone who comes to this list  working for a company or a
>>> university ? Would'nt their university be really upset if they gave
>>> out their bosses unpublished work on the internet and fire them on the
>>> spot ? Do those people pay for these services  ? Oh, A small number of
>>> times I have answered questions, should I expect to be paid for that ?
>>>
>>> Thank you,
>>> Ashim.
>>>
>>> On Wed, Jan 7, 2009 at 10:48 PM, Nick Cox <[email protected]> wrote:
>>>>
>>>> Sorry, Ashim, but I really don't understand your comments here.
>>>>
>>>> First off, local macros are useless unless used in some code. Whether
>>>> that use is interactive, via a do file, or via a program is up to you.
>>>>
>>>> If you want to be absolutely sure that certain collaborators, and only
>>>> those collaborators, see that code, then you need to send it encrypted.
>>>> That would apply to a do file or a program, and does not _itself_ rule
>>>> out do files.
>>>>
>>>> Second, saving macros in the data file runs into the same issues. You
>>>> would need to encrypt that too, as any Stata user with the same version
>>>> could in principle read your data file too.
>>>>
>>>> In short, wanting absolute security seems to me orthogonal to all other
>>>> details here.
>>>>
>>>> For myself, I always remember what Howard Aiken said. Don't worry about
>>>> people stealing your ideas; if they're any good, you will have to ram
>>>> them down their throats.
>>>>
>>>> Nick
>>>> [email protected]
>>>>
>>>> P.S. If you are developing proprietary code, why do you expect free
>>>> help? Shouldn't you offer to pay us?
>>>>
>>>> Ashim Kapoor
>>>>
>>>> Well in my opinion the do file won't do. Simply because the 1st half
>>>> of my code is proprietary, I dont wnat any1 to see it. I do wnat them
>>>> to USE the local macros / dataset at the end of the 1st half. Maybe I
>>>> am more clear now.
>>>>
>>>> On Wed, Jan 7, 2009 at 10:26 PM, Nick Cox <[email protected]> wrote:
>>>>
>>>>> A matrix could not be used for macros with string content. (Strictly,
>>>>> all macros are strings, but clearly some have numeric content.)
>>>>>
>>>>> Nick
>>>>> [email protected]
>>>>>
>>>>> Philipp Rehm
>>>>>
>>>>> I think that's what do-files are for.
>>>>>
>>>>> Nevertheless: how about building up a matrix which contains the local
>>>>> macros you encounter, which you then save into a variable? You could
>>>>> then recover the local macros with -levelsof-, for example.
>>>>>
>>>>> But I guess a do-file is the more straightforward approach...
>>>>>
>>>>>
>>>>> Ashim Kapoor wrote:
>>>>>>
>>>>>> I somehow feel that you can save local macros in a way other than
>>>>>> using -notes- can you ??
>>>>>>
>>>>> *
>>>>> *   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/
>>>>
>>>> *
>>>> *   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/
>>>
>> *
>> *   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index