Statalist The Stata Listserver


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

st: first program


From   Dirk Nachbar <Dirk.Nachbar@dwp.gsi.gov.uk>
To   statalist <statalist@hsphsun2.harvard.edu>
Subject   st: first program
Date   01 Jun 2006 12:57:57 +0100

All

I am trying to write my first Stata program and was wondering if someone could go through it and tell me if it's correct, how I should refer to id and what rclass means (just copied that).

Another thing, I compiled it once and then wanted to recompile it. How do I do that?

Thanks, Dirk

/*

program to balance an unbalanced panel, keep only those individuals with the max duration

*/

program balance, rclass

version 8.2

syntax id [if] [in]

qui     {

    sort id

    by id: egen count=count(id)

    sum count

    local max=r(max)

    keep if count==max

    }

end

Dirk Nachbar

Assistant Economist

Pensim2

Department for Work and Pensions

Level 4, The Adelphi

1-11 John Adam St

WC2N 6HT London

020 796 28531 ********************************************************************** This document is strictly confidential and is intended only for use by the addressee. If you are not the intended recipient, any disclosure, copying, distribution or other action taken in reliance of the information contained in this e-mail is strictly prohibited. Any views expressed by the sender of this message are not necessarily those of the Department for Work and Pensions. If you have received this transmission in error, please use the reply function to tell us and then permanently delete what you have received. Please note: Incoming and outgoing e-mail messages are routinely monitored for compliance with our policy on the use of electronic communications. **********************************************************************
The original of this email was scanned for viruses by Government Secure Intranet (GSi) virus scanning service supplied exclusively by Cable & Wireless in partnership with MessageLabs.
On leaving the GSI this email was certified virus free.
The MessageLabs Anti Virus Service is the first managed service to achieve the CSIA Claims Tested Mark (CCTM Certificate Number 2006/04/0007), the UK Government quality mark initiative for information security products and services. For more information about this please visit www.cctmark.gov.uk




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