Statalist


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

st: New version of -keyby- on SSC (again)


From   "Newson, Roger B" <[email protected]>
To   statalist <[email protected]>
Subject   st: New version of -keyby- on SSC (again)
Date   Tue, 21 Apr 2009 12:13:54 +0100

Thanks to Kit Baum, a new version of the -keyby- package is now available for download from SSC, superseding the version announced yesterday. In Stata, use the -ssc- command to install this, or -adoupdate- if you already have an old version installed.

The -keyby- package is described as below on my website. The new version fixes a minor typo in the on-line help. More importantly, the -keybygen- command (but not he -keyby- command) now has the ability to work with an empty varlist, in which case the dataset is keyed by the generated variable specified by the -generate()- option, which will then contain the sequential order of the observation in the whole dataset. This new variable will be the first variable in the dataset, unless the user specifies the -noorder- option.

I would like to thank David Kantor for alerting me to the typo in the on-line help, and also for drawing my attention to his -assertky- package, which users can also download from SSC. The -assertky- package performs a similar function to -keyby-, but does not restore the dataset to its original state in the event of failure or the user pressing -Break- (as -keyby- and -keybygen- do).

Best wishes

Roger

Roger B Newson BSc MSc DPhil
Lecturer in Medical Statistics
Respiratory Epidemiology and Public Health Group
National Heart and Lung Institute
Imperial College London
Royal Brompton Campus
Room 33, Emmanuel Kaye Building
1B Manresa Road
London SW3 6LR
UNITED KINGDOM
Tel: +44 (0)20 7352 8121 ext 3381
Fax: +44 (0)20 7351 8322
Email: [email protected] 
Web page: http://www.imperial.ac.uk/nhli/r.newson/
Departmental Web page:
http://www1.imperial.ac.uk/medicine/about/divisions/nhli/respiration/popgenetics/reph/

Opinions expressed are those of the author, not of the institution.

-------------------------------------------------------------------------
package keyby from http://www.imperial.ac.uk/nhli/r.newson/stata10
-------------------------------------------------------------------------

TITLE
      keyby: Key the dataset by a variable list

DESCRIPTION/AUTHOR(S)
      keyby sorts the dataset currently in memory by the variables in a
      varlist, checking that the variables in the varlist uniquely
      identify the observations.  This makes the variables in the
      varlist a primary key for the dataset in memory.  If the user does
      not specify otherwise, then keyby also reorders the variables in
      the varlist to the start of the variable order in the dataset, and
      checks that all values of these variables are nonmissing.
      keybygen sorts the dataset currently in memory by the variables in
      a varlist, preserving the existing order of observations within
      each by-group, and then generates a new variable, containing the
      sequential order of each observation within its by-group, to form
      a primary key with the existing variables in the varlist.  keyby
      and keybygen can be useful if the user combines multiple datasets
      using merge, which may cause a dataset in memory to become
      unsorted.
      
      Author: Roger Newson
      Distribution-Date: 20april2009
      Stata-Version: 10

INSTALLATION FILES                                  (click here to instal
> l)
      keyby.ado
      keybygen.ado
      keyby.sthlp
      keybygen.sthlp
-------------------------------------------------------------------------
(click here to return to the previous screen)

*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index