Statalist


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

Re: RE: st: Build groups with the same first two numbers of SIC


From   "Hua Pan" <panhua@gmx.de>
To   statalist@hsphsun2.harvard.edu
Subject   Re: RE: st: Build groups with the same first two numbers of SIC
Date   Fri, 20 Mar 2009 13:41:49 +0100

Dear Nick

You are right. The code von Michael is much easier then the loop, so I will take his code. So there is no need to use -capture- here.

I think -Capture- is sometimes useful for loop and I will take your advice and use "capture" behind the command that might return. Thank you for your explanation.

Best Regards

Hua
-------- Original-Nachricht --------
> Datum: Fri, 20 Mar 2009 11:22:56 -0000
> Von: "Nick Cox" <n.j.cox@durham.ac.uk>
> An: statalist@hsphsun2.harvard.edu
> Betreff: RE: st: Build groups with the same first two numbers of SIC

> There's some minor confusion here. I didn't recommend fixing your loop
> with -capture-, as there is no need to write a loop in the first place. 
> 
> More specifically, it's not a case of anybody's preference for return
> codes. The return codes to work with are those that a command might return. In
> many cases, the return code is 0 if something works and some non-zero code
> if it doesn't, and the programmer can work on that basis. 
> 
> Nick 
> n.j.cox@durham.ac.uk 
> 
> Hua Pan
> 
> Thank you very much for your help. 
> 
> Michael, your command is great, very effective. That’s exactly what I
> want and failed to find. Thank you indeed.
> 
> Martin and Nick, Thank you for your suggestions. After I added
> “capture” before “by”, the loop continued to work, and I also got the daily
> mean return for all firms with this complicate method. After I typed, 
> -di in red _rc-
> the return code was 198. Does that mean that this code is wrong? Error
> (198)
> When I put “capture” before “by” and “save”, the loop also
> continued to work and I got what I want, but this time the return code was
> zero. 
> “Capture” is really useful, that can help me a lot later, so I want to
> know why there are different return codes and which one should I prefer?
> Thanks a lot in advance.
> 
> 
> *
> *   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/

-- 
Psssst! Schon vom neuen GMX MultiMessenger gehört? Der kann`s mit allen: http://www.gmx.net/de/go/multimessenger01
*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index