Notice: On March 31, it was **announced** that Statalist is moving from an email list to a **forum**. The old list will shut down on April 23, and its replacement, **statalist.org** is already up and running.

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

From |
"Martin Weiss" <martin.weiss1@gmx.de> |

To |
<statalist@hsphsun2.harvard.edu> |

Subject |
RE: st: programming error with -generate- |

Date |
Tue, 9 Mar 2010 00:16:35 +0100 |

<> " Perhaps because of its relation to hexadecimal formats, we should just avoid using it when programming." Yet the fact that "y" was constant in your initial example, in spite of "x" running from 1 to 10, gave all possible indications that something was seriously amiss. So my guess is that any serious debugging would uncover this flaw. (Never hurts to at least run -inspect- on your newly created vars, does it?) HTH Martin -----Original Message----- From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Visintainer, Paul Sent: Dienstag, 9. März 2010 00:12 To: 'statalist@hsphsun2.harvard.edu' Subject: RE: st: programming error with -generate- Thanks, Stas. I think I'm beginning to understand. My concern is that x is such a generic variable name used by most of us for programming equations. Perhaps because of its relation to hexadecimal formats, we should just avoid using it when programming. -p ___________________________________ Paul F. Visintainer, PhD Baystate Medical Center Springfield, MA 01199 -----Original Message----- From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Stas Kolenikov Sent: Monday, March 08, 2010 4:58 PM To: statalist@hsphsun2.harvard.edu Subject: Re: st: programming error with -generate- Some indication can be found in help format##xformat about heXadecimal formats. So 1.2x is getting interpreted as 1 + 2/16 = decimal 1.125. However if you try to -display- it directly, it does not come out; it needs to be wrapped inside an expression of some kind to get evaluated. On Mon, Mar 8, 2010 at 3:51 PM, Kieran McCaul <Kieran.McCaul@uwa.edu.au>wrote: > ... > > > or try this: > > > > clear > > forvalues i = 1/9 { > di 1.`i'x + 1 > } > > > > -----Original Message----- > From: owner-statalist@hsphsun2.harvard.edu > [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Partha Deb > Sent: Tuesday, 9 March 2010 5:49 AM > To: statalist@hsphsun2.harvard.edu > Subject: Re: st: programming error with -generate- > > For even more head scratching, try this: > > clear all > > forvalues i=1/6 { > set obs 10 > gen y = 1.2x + `i' > tab y > drop _all > } > > Partha > > > Visintainer, Paul wrote: > > I have a question which I hope merely reflects that I'm missing > something obvious or a syntax that I don't recognize. I'm using version > 10.1 MP on a PC. I've run this on three different PCs and get the same > result. Why doesn't the generate command for "y" give an error? The > -generate- command gives errors for y1, y2, and y3. Also, I don't > understand the output for -tab- command for "y". Is there some syntax > that I'm not aware of? > > > > What am I missing here? > > > > > > . clear > > . set obs 10 > > obs was 0, now 10 > > > > . range x 1 10 > > . range t 1 10 > > . range w 1 10 > > > > . gen y = 1.2x + 6 <----- why isn't there an error here? > > > > . gen y1 = 1.2t + 6 > > 2t invalid name > > r(198); > > > > . gen y2 = 1.2w + 6 > > 2w invalid name > > r(198); > > > > . gen y3 = 2x + 6 > > 2x invalid name > > r(198); > > > > > > . tab y > > > > y | Freq. Percent Cum. > > ------------+----------------------------------- > > 72 | 10 100.00 100.00 > > ------------+----------------------------------- > > Total | 10 100.00 > > > > > > > > ___________________________________ > > Paul F. Visintainer, PhD > > Baystate Medical Center > > Division of Academic Affairs - 3rd Floor > > Springfield, MA 01199 > > > > ---------------------------------------------------------------------- > > CONFIDENTIALITY NOTICE: This email communication and any attachments > may contain confidential and privileged information for the use of the > designated recipients named above. If you are not the intended > recipient, you are hereby notified that you have received this > communication in error and that any review, disclosure, dissemination, > distribution or copying of it or its contents is prohibited. If you have > received this communication in error, please reply to the sender > immediately or by telephone at (413) 794-0000 and destroy all copies of > this communication and any attachments. For further information > regarding Baystate Health's privacy policy, please visit our Internet > web site at http://www.baystatehealth.com. > > > > * > > * 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/ > > > > -- > Partha Deb > Professor of Economics > Hunter College > ph: (212) 772-5435 > fax: (212) 772-5398 > http://urban.hunter.cuny.edu/~deb/ > > Emancipate yourselves from mental slavery > None but ourselves can free our minds. > - Bob Marley > > * > * 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/ > -- 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/ ---------------------------------------------------------------------- CONFIDENTIALITY NOTICE: This email communication and any attachments may contain confidential and privileged information for the use of the designated recipients named above. If you are not the intended recipient, you are hereby notified that you have received this communication in error and that any review, disclosure, dissemination, distribution or copying of it or its contents is prohibited. If you have received this communication in error, please reply to the sender immediately or by telephone at (413) 794-0000 and destroy all copies of this communication and any attachments. For further information regarding Baystate Health's privacy policy, please visit our Internet web site at http://www.baystatehealth.com. * * 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/

**References**:**st: programming error with -generate-***From:*"Visintainer, Paul" <Paul.Visintainer@baystatehealth.org>

**Re: st: programming error with -generate-***From:*Partha Deb <partha.deb@hunter.cuny.edu>

**RE: st: programming error with -generate-***From:*"Kieran McCaul" <Kieran.McCaul@uwa.edu.au>

**Re: st: programming error with -generate-***From:*Stas Kolenikov <skolenik@gmail.com>

**RE: st: programming error with -generate-***From:*"Visintainer, Paul" <Paul.Visintainer@baystatehealth.org>

- Prev by Date:
**RE: st: programming error with -generate-** - Next by Date:
**RE: st: RE: Interpretation of quadratic terms** - Previous by thread:
**RE: st: programming error with -generate-** - Next by thread:
**RE: st: programming error with -generate-** - Index(es):