GDP s (idcycle) 0 1 0 1 0 1 0 1 0 1 0 1 0 1 1 1 0 0 0 0 -1 0 0 1 0 1 0 1 Hi, I need generate a variable to idetify cycles GDP like in the above example. Put 1 when GDP was growing (0-1) including the point break, and 0 when GDP was decreasing (0-(1)). Any ideas?? Javier. |
From: SPSSX(r) Discussion [mailto:[hidden email]]
On Behalf Of javier meneses GDP s (idcycle) 0 1 --- 0 1 | why is this set of gdp=0 coded as ‘1’ 0 1 | 0 1 | 0 1 | 0 1 | 0 1 -- 1 1 0 0 | but this set of gdp=0 coded as ‘0’ 0 0 | -1 0 0 1 -- 0 1 | and this set is now coded as ‘1’ 0 1 -- Does gdp=0 have multiple meanings? It’d seem like gdp=1 would mean a period to period increase greater than ‘x’; gdp=0 would mean a period to period change of +/- ‘x’ and gdp=-1
would mean a period to period decrease greater than ‘x’. Gene Maguin Hi, I need generate a variable to idetify cycles GDP like in the above example. Put 1 when GDP was growing (0-1) including the point break, and 0 when GDP was decreasing (0-(1)). Any ideas?? Javier. ===================== 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
|
Eugene, from GDP=0 to GDP=1 means it has been growing , then I want to s=1. And from GDP=0 to GDP=-1 it has been declining, then I want to s=0. Then GDP began to grow again to the next point (GDP=1).
Therefore s will values 0 and 1 indicating the expansionary and recessionary periods.
Javier
On Fri, May 22, 2015 at 2:50 PM, Maguin, Eugene <[hidden email]> wrote:
===================== 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 |
Administrator
|
In reply to this post by Javier Meneses
The following will produce the output you want for the example you provided. I don't know if it will work more generally, because I'm not sure I've completely understood what you are trying to do.
DATA LIST free / GDP (F2.0). BEGIN DATA 0 0 0 0 0 0 0 1 0 0 -1 0 0 0 END DATA. NUMERIC idcycle(F1). * Where GDP changes, set idcycle = 1 if it * increases, and idcycle = 0 if it decreases. DO IF GDP GT LAG(GDP). . COMPUTE idcycle = 1. ELSE IF GDP LT LAG(GDP). . COMPUTE idcycle = 0. END IF. * Where idcycle is missing, replace it with the preceding value. IF MISSING(idcycle) idcycle = LAG(idcycle). * Where idcycle is still missing, sort cases in reverse order, * then replace SYSMIS with the preceding value. COMPUTE Case = $Casenum. SORT CASES by Case(D). IF MISSING(idcycle) idcycle = LAG(idcycle). * Restore original order of the cases. SORT CASES by Case(A). LIST GDP idcycle. OUTPUT: GDP idcycle 0 1 0 1 0 1 0 1 0 1 0 1 0 1 1 1 0 0 0 0 -1 0 0 1 0 1 0 1
--
Bruce Weaver bweaver@lakeheadu.ca http://sites.google.com/a/lakeheadu.ca/bweaver/ "When all else fails, RTFM." PLEASE NOTE THE FOLLOWING: 1. My Hotmail account is not monitored regularly. To send me an e-mail, please use the address shown above. 2. The SPSSX Discussion forum on Nabble is no longer linked to the SPSSX-L listserv administered by UGA (https://listserv.uga.edu/). |
In reply to this post by Javier Meneses
it looks like GDP can have 3 values. 0,1,-1. If this is correct then it seems that it is possible to have
9 situations so one approach would be to have something like this (untested) fill in the blanks If $casenum eq 1 s = -9. do if $casenum gt 1. if GDP eq -1 and lag(GDP) eq -1 s= ____. if GDP eq -1 and lag(GDP) eq 0 s= ____. if GDP eq -1and lag(GDP) eq 1 s= ____. if GDP eq 0 and lag(GDP) eq -1 s= ____. if GDP eq 0 and lag(GDP) eq 0 s= ____. if GDP eq 0 and lag(GDP) eq 1 s= ____. if GDP eq 1 and lag(GDP) eq -1 s= ____. if GDP eq 1 and lag(GDP) eq 0 s= ____. if GDP eq 1 and lag(GDP) eq 1 s= ____. end if. Missing vlaues s (-9).
Art Kendall
Social Research Consultants |
thank you all for your invaluable help! javier 2015-05-22 18:07 GMT-04:00 Art Kendall <[hidden email]>: it looks like GDP can have 3 values. 0,1,-1. If this is correct then it |
Administrator
|
Javier, I think many of us were not entirely clear on what "rule" you were trying to implement. What was the final solution that worked for you? Please post your syntax. Thanks.
--
Bruce Weaver bweaver@lakeheadu.ca http://sites.google.com/a/lakeheadu.ca/bweaver/ "When all else fails, RTFM." PLEASE NOTE THE FOLLOWING: 1. My Hotmail account is not monitored regularly. To send me an e-mail, please use the address shown above. 2. The SPSSX Discussion forum on Nabble is no longer linked to the SPSSX-L listserv administered by UGA (https://listserv.uga.edu/). |
Hi, I thought it was clear my problem. To make it even clearer , I had forgotten to point out that it was to data panel. It has series of quarterly GDP by country and variable identifying changing trends . 1 ends cycle of increasing and -1 ends cycle decreasing. The idea was to create a variable that identifies the cycle from initiating the growth period to completion with 1, and conversely since period decay begins to completion with 0. i=country q=quarter t=trend break GDP
i q tp pib
Argentina 1993q1 0 18.51328
Argentina 1993q2 0 18.54036
Argentina 1993q3 0 18.56262
Argentina 1993q4 0 18.57188
Argentina 1994q1 0 18.58643
Argentina 1994q2 0 18.60348
Argentina 1994q3 0 18.60693
Argentina 1994q4 1 18.62007
Argentina 1995q1 0 18.60672
Argentina 1995q2 0 18.56648
Argentina 1995q3 -1 18.56221
Argentina 1995q4 0 18.56961
2015-05-25 11:28 GMT-04:00 Bruce Weaver <[hidden email]>: Javier, I think many of us were not entirely clear on what "rule" you were |
Free forum by Nabble | Edit this page |