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: simulate error


From   Stas Kolenikov <[email protected]>
To   "[email protected]" <[email protected]>
Subject   Re: st: simulate error
Date   Tue, 11 Mar 2014 11:53:31 -0500

Before giving your program a name, it may be prudent to check if it's
"available" with

capture noisily which mark
capture noisily which mymark

and may be even with

findit mark
findit mymark

if you are planning to share it with others.

Mark, your program may also benefit from -version- statement at the
top. Also, you don't really need to make it -rclass- since the results
of -summarize- will still be in the memory when you exit from your
program (or you can just -return add- everything that -summarize- had
produced, just to make sure you did not lose it). And substantively,
unweighted mean and standard deviation make no sense for a stratified
sample that you are pulling. Just warning you.


-- Stas Kolenikov, PhD, PStat (ASA, SSC)
-- Principal Survey Scientist, Abt SRBI
-- Opinions stated in this email are mine only, and do not reflect the
position of my employer
-- http://stas.kolenikov.name



On Tue, Mar 11, 2014 at 10:15 AM, Nick Cox <[email protected]> wrote:
> Strictly, there is absolutely nothing illegal about the name "mark"
> for a program. If there were, no such command could exist, official or
> user-written.
>
> It's just that it is pointless to use that name for your own programs,
> as your own program will not be executed when you use the name, as you
> have discovered.
>
> It's possible in this case to subvert that, but anyone who knows how
> does not need to be told, and I really don't recommend what I am not
> going to explain.
> Nick
> [email protected]
>
>
> On 11 March 2014 15:10, Mark Baerthel <[email protected]> wrote:
>> Dear Nick,
>> Dear Scott,
>>
>> thank you so much for your help.
>> I did not realize thet "mark" was an illegal program name !!
>>
>> Thank you so much.
>>
>> Kind regards
>>
>> Mark
>>
>> On Tue, Mar 11, 2014 at 4:01 PM, Nick Cox <[email protected]> wrote:
>>> I have difficulty knowing what you realised but did not tell us!
>>>
>>> However, I see a different and more convincing problem.
>>>
>>> -mark- is an existing Stata command. So, any attempt to run a program
>>> -mark- will always be interpreted in favour of the existing command.
>>> Your syntax is, as far as official -mark- is concerned, quite illegal.
>>>
>>> Hence rename your program so that it does not clash in name with
>>> existing commands. To check compatibility, use -which-.
>>>
>>> Nick
>>> [email protected]
>>>
>>>
>>> On 11 March 2014 14:51, Mark Baerthel <[email protected]> wrote:
>>>> Dear Nick,
>>>>
>>>> thank you. but that is not the Problem. I already realized that.
>>>>
>>>> I still get the error.
>>>>
>>>> MB
>>>>
>>>> On Tue, Mar 11, 2014 at 3:41 PM, Nick Cox <[email protected]> wrote:
>>>>> return scalar sd   = r(sd
>>>>>
>>>>> is a typo of some kind. You need to close the parentheses.
>>>>> Nick
>>>>> [email protected]
>>>>>
>>>>>
>>>>> On 11 March 2014 14:04, Mark Baerthel <[email protected]> wrote:
>>>>>> clear all
>>>>>>
>>>>>> program define mark, rclass
>>>>>>
>>>>>> use ".\dta\full.dta"
>>>>>> keep if loan_status =="Fully Paid" | loan_status =="Charged Off"
>>>>>> keep if year == 2010
>>>>>> keep if term ==" 36 months"
>>>>>>
>>>>>> sample 5 if grade=="A" , count
>>>>>> sample 5 if grade=="B" , count
>>>>>> sample 5 if grade=="C" , count
>>>>>> sample 5 if grade=="D" , count
>>>>>> sample 5 if grade=="E" , count
>>>>>> sample 5 if grade=="F" , count
>>>>>> sample 5 if grade=="G" , count
>>>>>>
>>>>>> summarize ahpr_matured
>>>>>> return scalar mean = r(mean)
>>>>>> return scalar sd   = r(sd
>>>>>> end
>>>>>>
>>>>>> simulate pipi=r(mean) pipi2=r(sd), reps(10): mark
>>>>>>
>>>>>> ALWAYS GET THIS ERROR !!
>>>>>>
>>>>>> . simulate pipi=r(mean) pipi2=r(sd), reps(10): mark
>>>>>> nothing found where name expected
>>>>>> an error occurred when simulate executed mark
>>>>>> r(198);
>>>>>>
>>>>>>
>>>>>> why ??
>>>>>>
>>>>>> thank you so much.
>>>>>> *
>>>>>> *   For searches and help try:
>>>>>> *   http://www.stata.com/help.cgi?search
>>>>>> *   http://www.stata.com/support/faqs/resources/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/faqs/resources/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/faqs/resources/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/faqs/resources/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/faqs/resources/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/faqs/resources/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/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index