Re: How to enter cross-sectional time-series data into SPSS for correlation

Posted by PRogman on
URL: http://spssx-discussion.165.s1.nabble.com/How-to-enter-cross-sectional-time-series-data-into-SPSS-for-correlation-tp5726681p5726924.html

Hmm, after looking closer on your data I see you have coded all content variables as 1=Yes and 2=No, rather than 0=No.
You might want to do some data cleaning (several values 22)... see:

DESCRIPTIVES
  VARIABLES=Outlet TO Future_of_EU
  /STATISTICS=MEAN STDDEV MIN MAX.

Also, if you have values 1 & 2,  be careful when interpreting TotalCount (or here countYes) as it is a SUM(...).

With som modification of David Marso's code:
DATASET COPY copydata. 
DATASET ACTIVATE copydata. 

RECODE  ElectCamp TO  Future_of_EU (1=1) (2=0) (ELSE= -1).
MISSING VALUES ElectCamp TO  Future_of_EU (-1).
VALUE LABELS ElectCamp TO  Future_of_EU 0 'No'  1 'Yes' -1 '--' .

VARSTOCASES 
  MAKE topic_count FROM ElectCamp TO Future_of_EU 
 /INDEX=content(topic_count). 
DATASET DECLARE agg. 
AGGREGATE 
  OUTFILE agg 
 /BREAK Outlet day time content
 /countYes=SUM(topic_count)
 /totalCount=N. 
DATASET ACTIVATE agg.
SORT CASES BY content day time. 
CASESTOVARS ID=content day . 
SPLIT FILE BY content. 

CORRELATIONS countYes.1 WITH countYes.2 . 
hopefully you have more data Days...

HTH
   /PR