[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
RE: st: RE: marksample
"Nick Cox" <firstname.lastname@example.org>
RE: st: RE: marksample
Thu, 11 Sep 2008 13:21:07 +0100
Your understanding is not correct.
In your example of st_view()-, -touse- contains the name of one
variable. This is explained in the help.
Nor does -marksample- produce a list of variable names. It produces a
single variable containing 1s or 0s as appropriate. As already explained
in my previous message, it marks observations.
I continue to think your strategy here ill-advised. You would need to
write a special Mata program or think up special Stata code for almost
every row-wise task you envisage.
Thank you for your time. Also thank you for your note on sortrows.
Currently I am working on making " sortkeyrows" an ado file which will
sort using a key. I will email the ado file to the list once I am
done. I came across marksample while examining the code for sortrows.
Let me rephrase my question.
In the ado file for sortrows. we say " marksample touse".
Later on we say st_view(X,., tokens(varlist), touse)
Now if I understand st_view correctly touse should be a string of
variable names which should be non zero for selection of values. But
marksample is NOT producing is list of variable names.
Where am I wrong?
On 9/11/08, Nick Cox <email@example.com> wrote:
> -marksample- is not part of Mata. It is a Stata command.
> It marks observations, not variables.
> It produces a new temporary variable, not a matrix.
> It is possible to use -marksample- independently of -syntax-:
> . sysuse auto
> (1978 Automobile Data)
> . local if "2 == 2"
> . marksample touse, novarlist
> . su `touse'
> Variable | Obs Mean Std. Dev. Min Max
> __000000 | 74 1 0 1 1
> However, it is usual to use -marksample- after -syntax-, or after a
> of commands that produced similar results. I can't think up a
> kind of situation in which -marksample- is the command of choice.
> Ashim Kapoor
> I am trying to learn MATA. I have a query. What is marksample ? Does
> it return a matrix with 0's in place of variables which are NOT
> marked. Is it ONLY used after syntax ?
> I did not find the help very useful. Can someone please shed some
> light on this ?
* For searches and help try: