Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: subset (using by ...)


From   Joseph Coveney <[email protected]>
To   Statalist <[email protected]>
Subject   Re: st: subset (using by ...)
Date   Fri, 18 Jul 2003 01:35:04 +0900

Nemo Johnson wrote:

--------------------------------------------------------------------------------

  I note that in another package, data can be completely subset into separate
temporary datasets without having any effect on the original.  I know, of
course, that stata can do the same thing using "by" or "drop/keep", but the
logic seems different (in Stata, the "by" statements clearly need to
continually recur, and using "keep" requires great caution).

  Yes of course I know this is just a taste issue, but perhaps there is a
command I'm unaware of.  Any suggestions?

--------------------------------------------------------------------------------


Nick Cox responded:

--------------------------------------------------------------------------------

This question is rather general: I don't get a clear
sense of what specific flexibility you're missing.

However, Stata doesn't offer a way of doing this
as such. You can -save- parts of the data
as separate data sets, you can do things to
subsets, as you indicate, etc.

I think the return question is: what do you
want to do that you think you can't do in Stata?

--------------------------------------------------------------------------------


I think that Nemo wasn't saying that you couldn't subset a dataset with Stata, 
but that it seemed less straightforward than with another package.  Others have 
mentioned the same thing.  See, for example, 

www.stanford.edu/class/hrp223/2002f/OtherTalks/ClinicalTrials2002.ppt , 

in particular, Slide 56 in comparison to Slides 36 and 49.

I'm not sure whether this would be a reasonable or even feasible alternative, 
but with Stata Release 8 with currently updated executable and ados, you can 
execute structured query language (SQL) statements to any available data source 
name (DSN).  See help -odbc-.  Prior to this, Stata could only import from an 
open database connectivity (ODBC) data source.  I haven't tried it yet, so I 
don't know whether it would work, but -odbc exec()- might be the basis for a 
way to subset a dataset in memory to multiple temporary datasets (DSNs to a 
spreadsheet or database created for the purpose) without affecting the dataset 
in memory.

Joseph Coveney



*
*   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