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: Program def syntax
From
"Johannes N. Blumenberg" <[email protected]>
To
<[email protected]>
Subject
Re: st: Program def syntax
Date
Tue, 25 Feb 2014 11:37:38 +0100
Nick and Billy:
oh my gosh, please excuse this question (and its title) - everything
solved and perfectly fine now.
I was standing in my own way apparently since I was sure I tried it with
marks before.
Thank you very much!
Am 25.02.2014 11:32, schrieb Nick Cox:
There is no black sorcery here. The only nuance here is the difference
between a thing and its name.
You allow -by()- so if you specify -by()- a consequence of the
-syntax- command is that it creates the local macro -by- containing
the name(s) of the variable you specify.
Suppose you specify
... , by(foreign)
then
di `by'
is interpreted by -display- as a request to
di foreign
and (what may be a surprise here) -display- is not in the habit of
displaying entire variables, so as a token of good-will it acts as if
you really meant
di foreign[1]
In your case, you should find that the value 1.2 relates somehow to
your variables and their values in the first observation.
What you want, naturally, is to see the _names_ themselves and to
insist on that you put
di "`by'"
where the " " emphasise to Stata that you want the string interpretation.
(When debugging I sometimes use -macro list- as a quick and dirty way
to get Stata to show the contents of all macros.)
Nick
[email protected]
On 25 February 2014 10:19, Johannes N. Blumenberg
<[email protected]> wrote:
I got a small question regarding the program define syntax. I defined a
program and set its syntax to
syntax varlist [, BY(varlist) MOreoff]
However, I am unable to access the varlist defined in "by". All that Stata
returns to me is that the statement is true, when I try to display its
content with the help of di `by'.
When I put three variables into the by argument Stata returns "1.2". All
reading in the guidelines etc did not help me.
So, which kind of black sorcery is needed to return the variablelist defined
in `by'? :)
*
* 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/
--
Johannes N. Blumenberg, M.A.
Johannes Gutenberg-Universität Mainz
Institut für Politikwissenschaft
Bereich "Empirische Politikforschung"
55099 Mainz
Besucher-/Paketanschrift
Hegelstr. 59
Raum 06-211
55122 Mainz
Tel.: +49 6131 39 38463
E-Mail: [email protected]
WWW: www.Johannes-Blumenberg.de
*
* 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/