Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

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

st: New package -gsgroup- on SSC

From   "Roger B. Newson" <>
To   "" <>
Subject   st: New package -gsgroup- on SSC
Date   Wed, 03 Oct 2012 11:54:36 +0100

Thanks again to Kit Baum, a new package -gsgroup- is now available for download from SSC. In Stata, use the -ssc- command to do this.

The -gsgroup- package is described as below on my website, and creates a grouping variable corresponding to a -gsort- key, leaving the data in their original order. Optionally, it also creates an output dataset (or resultsset) with 1 observation per value of the group variable, and data on the corresponding -gsort- key values. This can be useful when we create a concatenated resultsset whose observations contain values of the generated group variable, and we want it also to contain the corresponding -gsort- key variables. The online help for -gsgroup- contains an example using -gsgroup- with -margins- and the SSC package -parmest-.

Best wishes


package gsgroup from

gsgroup: Create a group variable and optionally an output dataset for a gsort key

      gsgroup inputs a gsort key (a list of elements of the form used
      by gsort), and generates as output a new variable, indicating
      the sequential order of the group to which each observation
      belongs, and (optionally) an output dataset (or resultsset),
      with 1 observation per group, and data on the values of the
      generated variable, and the variables of the gsort key
      corresponding to that group.  Unlike gsort, gsgroup does not
      change the sort order of the dataset in memory.  The output
      dataset can be merged into other datasets, using the official
      Stata command merge or the SSC package addinby.  gsgroup is
      typically used together with the SSC packages parmest and

      Author: Roger Newson
      Distribution-Date: 27september2012
      Stata-Version: 10

INSTALLATION FILES                                  (click here to install)
(click here to return to the previous screen)

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
Tel: +44 (0)20 7352 8121 ext 3381
Fax: +44 (0)20 7351 8322
Web page:
Departmental Web page:

Opinions expressed are those of the author, not of the institution.
*   For searches and help try:

© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index