Statalist


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

st: Re: What is wrong with this syntax?


From   "Michael Blasnik" <michael.blasnik@verizon.net>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: Re: What is wrong with this syntax?
Date   Sat, 21 Jul 2007 15:42:08 -0400

...

You need to -tokenize- your varlist to get them properly into local macros 1,2,3,etc.. Otherwise, 1,2,3 will hold command line "tokens" which will include adjacent commas.

Michael Blasnik


----- Original Message ----- From: "Kyle Hood" <kyle.hood@yale.edu>
To: <statalist@hsphsun2.harvard.edu>
Sent: Saturday, July 21, 2007 2:50 PM
Subject: st: What is wrong with this syntax?



I have attempting to write a command (in version 8), with the following syntax:

program hhk, eclass
syntax varlist(min=3 max=3)[, P(real 0.5)]
di "`1'"
di "`2'"
di "`3'"
...

If I use the following call:

. hhk a b c, p(0.3)

I get an error (when I first try to use variable c), and the program displays

a
b
c,

Why is it picking up the comma in the third variable? It doesn't do that for built-in stata commands.

Thanks,
Kyle
*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index