Hello,
I am new to Stata and I have the following problem:
I have data according: year statecode moneyindicator
2003 1005 1
to etc or
2015 0
With some years of data missing.
'Statecode' is a number assigned to a county/state in a country.
In the given dataset, the 'moneyindicator' variable can only be equal to 1 (meaning the state received money) as of 2008 (to 2015), so all data between 2003-2007 for this variable is always equal to 0.
What I need is code that makes 'moneyindicator' belonging to a certain 'statecode' equal to 1 for all the given years between 2003-2015 if 'moneyindicator' equals to 1 in any of the years between 2008-2015 that belong to the same 'statecode'.
So if 'moneyindicator' equals to 1 for statecode i in 2009-2015, I want a new variable that has value equal to 1 for statecode i in 2003-2015.
Thank you!
Related Posts with Expanding a variable value based on conditions of other variables
How do include virtual factor variables (created with i. or c. operators) in local macros to use them in for loops?I would like to run the following 4 sequential models. I would like to create interactions on the fl…
History Pane in Command window - how to set the max capacity of thishello stata people, complete newcomer here, I have been using the command history pane of the comman…
Data display in browser converting from 24 hr clock to 12 hour clockIn the data browser Stata is displaying 12jun2018 16:38:53 as 6/12/2018 4:33 as if it were labeling …
Why is this regression in Stata not progressing nor returning an error code?Note: Originally posted on Stack Overflow, but crossposted here following advice. I am running a m…
Getting more decimals from matcellDear statalisters, I am trying to obtain the percentages from a tabm table that uses weights and I …
Subscribe to:
Post Comments (Atom)
0 Response to Expanding a variable value based on conditions of other variables
Post a Comment