Posted by
Art Kendall on
URL: http://spssx-discussion.165.s1.nabble.com/Calculating-percent-change-using-panel-data-set-tp5713457p5713490.html
if you already have the data in an SPSS file GET
that file. Then substitute your variable names for the names in
my example syntax.
Begin data ... end data is used in the demo syntax because system
files (*.sav) cannot be attached to post to the discussion list.
Also the demo variable won't be needed once you see that you get
the same result for demo1yrago and since1yrago.
Recall that numerators and denominators need to be summed
separately to get overall rates or percents.
Get file = . . .
numeric since1yrago since2yrago
since3yrago(pct7.1).
do repeat periods = 1 to 3/ since= since1yrago to since3yrago.
do if hospital eq lag(hospital,periods) and year eq
lag(year,periods)+periods.
compute since = 100* ( ( ( (unemployed/lag(unemployed,periods)
) **(1/periods) ) )-1).
end if.
end repeat.
* calculate overall rates ASSUMING NO MISSING DATA.
sort cases by year.
dataset declare aggfile.
aggregate outfile=aggfile /break= year
/sum_unemployed = sum(unemployed).
dataset activate aggfile.
numeric since1yrago since2yrago since3yrago(pct7.1).
do repeat periods = 1 to 3/ since= since1yrago to since3yrago.
compute since = 100* ( ( ( (unemployed/lag(unemployed,periods) )
**(1/periods) ) )-1).
end repeat.
list.
_ if you have any missing data, medians would be meaningful as
summary statistics, overall rates based on sums would not be
meaningful.
Art Kendall
Social Research Consultants
On 6/2/2012 11:13 AM, Virginia Razo wrote:
Hello Art,
Thanks for taking your time to respond to my cry out for help. The data I
provided was just an example and I actually have more than 8000
observations. How can I enter the begining and end of data list without
typing every observations hospital by year?
Kind Regards,
Ginny
--
View this message in context: http://spssx-discussion.1045642.n5.nabble.com/Calculating-percent-change-using-panel-data-set-tp5713457p5713488.html
Sent from the SPSSX Discussion mailing list archive at Nabble.com.
=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
Art Kendall
Social Research Consultants