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: syntax behaving differently
From
Nick Cox <[email protected]>
To
[email protected]
Subject
Re: st: syntax behaving differently
Date
Tue, 7 Aug 2012 19:30:22 +0100
1. -marksample- marks out string variables unless you specify
otherwise. This is prominently documented.
2. #1 bites here too. With no varlist specified, your program implies
that everything is the varlist, and thus that observations are marked
out if any variable is a string variable, which is true in your case.
So nothing is listed.
3. That's what you asked for. Again, this is what -marksample- does on
your behalf.
It is hard to see what you are trying to do with this program, except
perhaps learn programming. It does no more, and in fact it does less,
than -list- can do.
Nick
On Tue, Aug 7, 2012 at 7:15 PM, tashi lama <[email protected]> wrote:
>
> I have a dataset
> var1 var2 var3 |
> |-----------------------|
> | Tom 1 5 |
> | Jane 2 6 |
> | Suzanne . 7 |
> | Henry 4 8 |
> | Mike 9 9 |
> and my ado file is following
> program tt1
> syntax [varlist] [if] [in]
> marksample touse
> list `varlist' if `touse'
> end
> exit
> 1. when I say tt1 var1, it doesn't list anything. Is it because var1 is string?Even it is, I haven't limited by varlist to not be string. Any clue/
> 2. when I say tt1, it doesn't list anything. Is it not supposed to list var1var2 and var3 since I have enclosed varlist with [] stating varlist to be optional. Any clue?
> 3. when I say tt1 var2, it lists var2 but ignores missing obs. Is there anoption to include both missing and nonmissing?
*
* 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/