Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

AW: AW: st: local containing (all) variables' names in a dataset


From   Martin Weiss <martin.weiss1@gmx.de>
To   statalist@hsphsun2.harvard.edu
Subject   AW: AW: st: local containing (all) variables' names in a dataset
Date   Mon, 17 Aug 2009 22:03:37 +0200

<> 


Well, the official one - though no longer updated - is 

which ds
C:\Program Files (x86)\Stata11\ado\base\d\ds.ado
*! version 5.0.1  24feb2005

while Nick`s are from 02/05/2002 and 24/02/1999, respectively...



HTH
Martin


-----Ursprüngliche Nachricht-----
Von: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] Im Auftrag von Eric A. Booth
Gesendet: Montag, 17. August 2009 22:01
An: statalist@hsphsun2.harvard.edu
Betreff: Re: AW: st: local containing (all) variables' names in a dataset

It's been updated to newer versions  by Nick Cox--see  -ds3- and -ds5-

ssc install ds3
ssc install ds5


Eric

__
Eric A. Booth
Public Policy Research Institute
Texas A&M University
ebooth@ppri.tamu.edu
Office: +979.845.6754


On Aug 17, 2009, at 1:06 PM, David Jacobs wrote:

> But -ds- still can be found after -help-
>
> Dave Jacobs
>
> At 11:49 AM 8/17/2009, you wrote:
>
>> <>
>>
>>
>> " a real hidden gem"
>>
>>
>>
>> Now demoted to "previously documented" status in Stata 11, though.  
>> Grrr....
>>
>>
>>
>> HTH
>> Martin
>>
>>
>> -----Ursprüngliche Nachricht-----
>> Von: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu 
>> ] Im Auftrag von Augusto Cadenas
>> Gesendet: Montag, 17. August 2009 17:13
>> An: statalist@hsphsun2.harvard.edu
>> Betreff: Re: st: local containing (all) variables' names in a dataset
>>
>> Gentlemen, thank you very much for these quick answers. -ds- seems to
>> do a very fine job, a real hidden gem, as Martin wrote. (and yes, I'm
>> aware that I'm replacing the original dataset.)
>>
>> Thanks again,
>> AC
>>
>>
>>
>> On Mon, Aug 17, 2009 at 3:49 PM, Martin Weiss<martin.weiss1@gmx.de>  
>> wrote:
>> >
>> > <>
>> >
>> >
>> > On -ds- also see
http://www.stata-journal.com/article.html?article=dm0040
>> >
>> >
>> > Are you sure you want to -replace- the original dataset with the - 
>> collapse-d
>> > one? Seems to me that is what you are doing in the line - save,  
>> replace -
>> >
>> >
>> >
>> > HTH
>> > Martin
>> >
>> >
>> > -----Ursprüngliche Nachricht-----
>> > Von: owner-statalist@hsphsun2.harvard.edu
>> > [mailto:owner-statalist@hsphsun2.harvard.edu] Im Auftrag von  
>> Scott Merryman
>> > Gesendet: Montag, 17. August 2009 15:47
>> > An: statalist@hsphsun2.harvard.edu
>> > Betreff: Re: st: local containing (all) variables' names in a  
>> dataset
>> >
>> > You can use macro list.  See -help macrolists-
>> >
>> > For example:
>> >
>> > . sysuse auto ,clear
>> > (1978 Automobile Data)
>> >
>> > . ds
>> > make          mpg           headroom      weight        turn
>> > gear_ratio
>> > price         rep78         trunk         length         
>> displacement
>> > foreign
>> >
>> > . local a = r(varlist)
>> >
>> > . local b  make rep78
>> >
>> > . local c:list  a - b
>> >
>> > . disp "`c'"
>> > price mpg headroom trunk weight length turn displacement  
>> gear_ratio foreign
>> >
>> >
>> > Scott
>> >
>> >
>> > On Mon, Aug 17, 2009 at 8:38 AM, Augusto Cadenas
>> > <aug.cadenas@googlemail.com> wrote:
>> >>
>> >> Dear statalisters,
>> >>
>> >> I have to collapse a series of datasets and I would appreciate  
>> your
>> >> help. The issue is that these datasets have different variables,  
>> but
>> >> always the same variable by which I want to collapse. So I have  
>> to run
>> >> the following command:
>> >>
>> >> collapse (mean) id (sum) [all other variables here], by(name)
>> >>
>> >> And I would like to embed this in a foreach loop of the type
>> >>
>> >> local datasets `"dataset1 dataset2 dataset3"'
>> >> foreach X of local datasets {
>> >>     use `X', clear
>> >>     collapse (mean) id (sum) [all other variables here], by(name)
>> >>     save, replace
>> >> }
>> >>
>> >> The issue for me is how to create a local that contains the  
>> names of
>> >> all variables in each dataset, except for "name" and "id". Any
>> >> suggestions are appreciated!
>> >>
>> >> Augusto
>> >
>> > *
>> > *   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/
>> >
>> >
>> > *
>> > *   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/
>> >
>>
>> *
>> *   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/
>>
>>
>> *
>> *   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/
>
>
>
> *
> *   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/


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




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



© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index