Many thanks Patrick that worked after first creating a new variable 'Counter' using the LAG function. Thanks for everyone's suggestions. Julie
Sent from my iPhone
Original Message:
Sent: 9/22/2023 4:41:00 AM
From: Patrick Henry-Lucet
Subject: RE: Restructuring long to wide
Hello there.
You can use casestovars with different rows count for each event:
CASESTOVARS
/ID=event
/GROUPBY=INDEX.
------------------------------
Patrick Henry-Lucet
------------------------------
Original Message:
Sent: Wed September 20, 2023 06:11 PM
From: Julie Selwyn
Subject: Restructuring long to wide
Hi all. I have a long dataset where the same respondents have multiple rows ( range 1-10 rows per person). In the rows are a variable events and variables of dates starting and ending the event and reasons why the event starts and ends. The reasons contain 15 different categorical variables ( numeric). I want to restructure from long to wide. But the coding I've tried scrambles the data. Some respondents can have multiple events in one year.
when restructured I want the data to be date event1 reason event1 date end 1 reason end 1. And so onup to 10 different groupings around each event. Any ideas how to do this? Julie
------------------------------
Julie Selwyn
------------------------------