Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Problem with macro: -twoway scatter- type mismatch


From   Friedrich Huebler <[email protected]>
To   [email protected]
Subject   st: Problem with macro: -twoway scatter- type mismatch
Date   Mon, 20 Nov 2006 13:14:54 -0800 (PST)

I use Stata 8.2 and built up a long macro in a loop. The macro is not
accepted by the -twoway- command and instead I get a "type mismatch
r(109);" error message. The problem can be reproduced with the auto
dataset.

. sysuse auto
. local scatter "(scatter mpg weight if make=="VW Diesel",
connect(l)) (scatter mpg weight if make=="AMC Pacer", connect(l))"
. twoway `"`scatter'"'
type mismatch
r(109);

It is possible to display the contents of the macro.

. di `"`scatter'"'
(scatter mpg weight if make=="VW Diesel", connect(l)) (scatter mpg
weight if make=="AMC Pacer", connect(l))

It is also possible to draw the graph by typing the complete -twoway-
command.

. twoway (scatter mpg weight if make=="VW Diesel", connect(l))
(scatter mpg weight if make=="AMC Pacer", connect(l))

Why does the macro not work with -twoway-? Can the problem be solved
by adding more quotes somewhere?

Friedrich


 
____________________________________________________________________________________
Sponsored Link

Mortgage rates near 39yr lows. 
$420k for $1,399/mo. Calculate new payment! 
www.LowerMyBills.com/lre
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   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