Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


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

st: vertical (within a column) calculations


From   "Mendoza Aldana, Dr Jorge Antonio (WPRO)" <MendozaAldanaj@wpro.who.int>
To   "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu>
Subject   st: vertical (within a column) calculations
Date   Tue, 10 Aug 2010 11:50:10 +0800

Dear all,
using Stata 10.1
I have a dataset with place, date and a variable lab that can take values from 1 to 4, and also missing values. I would like to generate a variable containing, for each place, the difference between the date of a record with lab==1 (my reference record within a place) and the date of the other records (within the same place).

I will appreciate very much if you could indicate the function(s) for doing this or the link dealing with.

Thank you very much in advance
Jorge

------ Data example -----------
PLACE     DATE    LAB
A	04 Mar 10	.
A	16 Mar 10	2
A	17 Mar 10	1
A	19 Mar 10	2
A	23 Mar 10	2
A	29 Mar 10	2
A	30 Mar 10	2
A	30 Mar 10	2
A	31 Mar 10	1
A	31 Mar 10	1
A	01 Apr 10	.
A	01 Apr 10	.
A	01 Apr 10	2
A	02 Apr 10	2
B	07 Jun 10	1
C	25 Jun 10	2
D	07 Feb 10	.
D	03 Mar 10	.
D	01 Apr 10	1
D	03 Apr 10	1
D	04 Apr 10	1
D	04 Apr 10	1
D	07 Apr 10	1
E	24 Jun 10	1
F	02 Apr 10	.
F	09 Apr 10	2
F	10 Apr 10	.
F	27 Apr 10	1
F	07 Apr 10	2
F	22 Apr 10	.
F	26 Mar 10	.

----------------------




====================================================
This message was scanned for viruses with Trend Micro ScanMail, GFI MailSecurity and  GFI MailEssentials by the World Health Organization Regional Office for the Western Pacific.  However, the recipient is advised to scan this e-mail and any attached files for viruses.

Disclaimer:

This e-mail, together with any attachments, is intended for the named recipients only and is confidential. It may also be privileged or otherwise protected by law.

If you have received it in error, please notify the sender immediately by reply e-mail and delete it and any attachments from your system. You may not copy or disclose its contents to anyone.


*
*   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   |   Site index