<>
********clear*
inp id str15 result str15 concept str15 abonaa str15 comm_date
300 Ei-svar veil FRIHET 30mar2008
300 Ei-svar veil FRIHET 19may2008
300 NA veil FRIHET 10jun2008
400 Ei-svar veil FRIHET 30mar2008
400 Ei-svar veil FRIHET 19may2008
400 NA veil FRIHET 10jun2008
400 FAILURE veil FRIHET 03nov2008
400 FAILURE veil FRIHET 17dec2008
400 SUCCESS veil FRIHET 14jan2009
end
bys id: replace result = "DM SUCCESS" if result=="NA" & concept=="veil" & abonaa=="FRIHET" & result[_N]=="SUCCESS"
l, noo sepby(id)
*********
HTH
Martin
-------- Original-Nachricht --------
> Datum: Mon, 16 Mar 2009 11:35:23 +0100
> Von: [email protected]
> An: [email protected]
> Betreff: st: replace in paneldata at specific dates
> I have a panel of data that looks like this,
>
> id result consept abonaa comm_date
> 400 Ei-svar veil FRIHET 30mar2008
> 400 Ei-svar veil FRIHET 19may2008
> 400 NA veil FRIHET 10jun2008
> 400 FAILURE veil FRIHET 03nov2008
> 400 FAILURE veil FRIHET 17dec2008
> 400 SUCCESS veil FRIHET 14jan2009
>
> I would like to recode the variable result = "DM SUCCESS" if result==NA,
> concept="veil" and abonaa="FRIHET", but only if the last comm_date for every
> member of the panel is not equal to SUCCESS in the variable result. In
> this case result = SUCCESS for comm_date=14jan2009, thus result="NA" stays
> equal to NA.
>
> However, in this example,
>
> id result consept abonaa comm_date
> 300 Ei-svar veil FRIHET 30mar2008
> 300 Ei-svar veil FRIHET 19may2008
> 300 NA veil FRIHET 10jun2008
>
> result=NA occurs at the last comm_date for id=300 thus I want to recode NA
> = "DM SUCCESS"
>
> Any suggestions would be appreciated?
>
> Best wishes,
> Alexander Severinsen
>
> *
> * 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/
--
Martin Weiss
Hackersteigle 3
72076 Tübingen
00497071/793535
00491784597218
Nur bis 16.03.! DSL-Komplettanschluss inkl. WLAN-Modem für nur
17,95 ¿/mtl. + 1 Monat gratis!* http://dsl.gmx.de/?ac=OM.AD.PD003K11308T4569a
*
* 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/