Statalist


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

st: Re: Generate Variable


From   "Martin Weiss" <[email protected]>
To   <[email protected]>
Subject   st: Re: Generate Variable
Date   Thu, 12 Mar 2009 00:49:26 +0100

<>
More Income in 1982 than in 1980? Let`s see...

*********
clear*
inp id year sex inc
1 80 0 5000
1 81 0 5500
1 82 0 6000
1 83 0 7000
2 80 1 2000
2 81 1 2200
2 82 1 3300
2 83 1 3500
3 80 0 3000
3 81 0 2000
3 82 0 1000
3 83 0 1000
4 80 0 3000
4 81 0 4000
4 82 0 1000
4 83 0 10000
end
*mark years to compare
tempvar compare
g byte `compare'=year==80 | year==82
*sort them to the end, within id and respecting years, and generate indicators
bys id (`compare' year) : g byte hi82=inc[_N]>inc[_N-1]
*resort
sort id year
drop `compare'
*let`s see
l, noo sepby(id)
*********


HTH
Martin
_______________________
----- Original Message ----- From: <[email protected]>
To: <[email protected]>
Sent: Wednesday, March 11, 2009 11:08 PM
Subject: st: Generate Variable


Hi Statalisters,

I have a quick question. I am trying to create a dummy
variable that is equal to 1 when organizations have more
properties in wave 6 compared to wave 4. My data is in long
form.

Logically, it would be something like this, but this does not
work, I am missing some steps.

gen HiPropertyw6= 1 if (numProp==wavenum==4 <
numInsArrng==wavenum==6).


Erick
Erick Guerrero, M.A.
Ph.D. Candidate
NIDA Predoctoral Fellow
School of Social Service Administration
The University of Chicago
*
*   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