Statalist The Stata Listserver

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

st: RE: Save results as a data file

From   "Maarten Buis" <>
To   <>
Subject   st: RE: Save results as a data file
Date   Fri, 15 Sep 2006 22:28:01 +0200

An alternative approach is to use to combine -egen- with -bys-, like the example below

*-------------begin example---------
sysuse auto, clear
bys rep78: egen sprice = sum(price)
bys rep78: keep if _n==1
keep rep78 sprice
*-------end example------


Maarten L. Buis
Department of Social Research Methodology 
Vrije Universiteit Amsterdam 
Boelelaan 1081 
1081 HV Amsterdam 
The Netherlands

visiting adress:
Buitenveldertselaan 3 (Metropolitan), room Z434 

+31 20 5986715

-----Original Message-----
From: []On Behalf Of Fan, Shihe
Sent: vrijdag 15 september 2006 22:16
Subject: st: Save results as a data file

Say, I have  a variable (x) with many levels in a file. I want to get
the total count of each level in a file.

*   For searches and help try:

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