Statalist The Stata Listserver


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

st: inconsistent behavior of -ds-


From   Caleb Southworth <[email protected]>
To   [email protected]
Subject   st: inconsistent behavior of -ds-
Date   Wed, 6 Sep 2006 17:55:11 -0700 (PDT)

I have been using -ds- to identify r(varlist) and then loop through those
variables. However, I am puzzled by the behavior of -ds, has(type #/#)-
syntax.

To illustrate what appears to be inconsistent behavior of -ds-, consider
this dataset with 9 string variables:

. desc

Contains data from uniondemoc82-3.dta
  obs:           180
 vars:            10
 size:        40,500 (99.9% of memory free)
-------------------------------------------------------------------------------
              storage  display     value
variable name   type   format      label      variable label
-------------------------------------------------------------------------------
union           str80  %80s
id              int    %8.0g
pres1           str20  %20s
treas1          str17  %17s
sect1           str20  %20s
sect2           str16  %16s
st1             str20  %20s
st2             str16  %16s
st3             str11  %11s
vp1             str19  %19s

. ds
union   id      pres1   treas1  sect1   sect2   st1     st2     st3
vp1

. ds , has(type string)
union   pres1   treas1  sect1   sect2   st1     st2     st3     vp1

. ds, has(type 2/8)

. ds , has(type 2/62)
pres1   treas1  sect1   sect2   st1     st2     st3     vp1

. ds , has(type 2/11)
st3

My goal is to have r(varlist) contain all the variables except the first
two (union and id), one of which is a string, other other numeric.

The question here is why -ds- lists some of the variables, specific
variables, or all variables.

Caleb
[email protected]
University of Oregon Sociology
*
*   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