How to count number of consecutive weeks with specific value

Moderators: statman, Analyst Techy, andris, Fierce, GerineL, Smash

BlipBlopDK
Posts: 1
Joined: Thu Jan 22, 2015 2:06 pm

How to count number of consecutive weeks with specific value

Postby BlipBlopDK » Thu Jan 22, 2015 2:17 pm

I am having a datafile, that looks like this:

ID - Y1101 - Y1102 - Y1103 - Y1104 .... - Y1452
1 - 100 - 100 - 200 - 100 .... - 100
2 - 200 - 100 - 100 - 100 .... - 100

Y1101 to Y1452 represents time series data for each case. Y1101 is the status in week 1 of 2011. Y1452 is the status in week 52 of 2014.

For each case I want to count for how many CONSECUTIVE weeks this case has a specific value (100, for instance) or a certain range of values (100-200 and 300-400, for instance) counting from week 52 of 2014 (variable Y1452) and backwards.

How can I do this in SPSS syntax?

BR Kim

Who is online

Users browsing this forum: No registered users and 2 guests

cron