Statalist


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

st: AW: Replacing the value of a variable


From   "Martin Weiss" <[email protected]>
To   <[email protected]>
Subject   st: AW: Replacing the value of a variable
Date   Thu, 14 Jan 2010 16:38:44 +0100

<> 



*************
clear*
set obs 5
 
gen byte subject= _n
expand 20
bys subject: gen byte time=_n

gen con=int(runiform()*20)

bys subject (time): gen byte firstcon=con[1]
*************



HTH
Martin


-----Ursprüngliche Nachricht-----
Von: [email protected]
[mailto:[email protected]] Im Auftrag von
[email protected]
Gesendet: Donnerstag, 14. Januar 2010 16:34
An: [email protected]
Betreff: st: Replacing the value of a variable

Hello,

for each given "subject" and for all 20 "period"s associated with the 
respective subject- I would like to fill the variable called "firstcon" 
  with the value of another variable "con" from "period" 1 of the 
respective subject.

For example: if subject 3's "con" variable in "period" 1 is "17" then 
this subject's "firstcon" variable should be filled with "17", for all 
periods from 1 to 20, i.e., for all 20 rows.

How can I do this? Thank you very much for your help!
Ozgur

-- 
Dr. Özgür Gürerk

Lehrstuhl für Mikroökonomie & Laboratorium für experimentelle 
Wirtschaftsforschung
(Microeconomics & Laboratory for Experimental Economics)

Universität Erfurt, Nordhäuser Str. 63, D-99089 Erfurt

Tel: +49 361 7374561
Fax: +49 361 7374569
www.uni-erfurt.de/elab
--

*
*   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/

*
*   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/


*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index