Hi Jamess
Thanks for the comment.
I have a Measure from different Patients (ID) and Dates.
From the measures I constructed the Direction (if the Measure increased since the last Date -> up, ...)
Now I want to distinguish the individual up and down movement:
up movments: down, stable, up, stable, stable, up,, down
down movment: up,up, stable, up, down, down, stable,stable,up
Below you see my input. The result is the Variable Group like in the first poste
CREATE TABLE #tmp
(
ID INT,
Date DATE,
Measure INT,
Direction VARCHAR(32),
);
INSERT INTO #tmp VALUES
(1,'20051011',3,'up'),
(1,'20051012',3,'stable'),
(1,'20051013,3,'stable'),
(1,'20051014,4,'up'),
(1,'20051015,3,'down'),
(1,'20051016,2,'down'),
(1,'20051017,'2,'stable'),
(1,'20051018,'2,'stable'),
(1,'20051019,'3,'up'),
(1,'20051020,3,'stable'),
(1,'20051021,2,'down'),
(1,'20051022,2,'stable'),
(1,'20051023,2,'stable'),
(1,'20051024,2,'stable'),
(1,'20051025,3,'up'),
(1,'20051026,3,'stable'),
(1,'20051027,3,'stable'),
(1,'20051028,3,'stable'),
(1,'20051029,3,'stable'),
(1,'20051030,3,'stable'),
(1,'20051101,2,'down'),
(1,'20051102,2,'stable'),
(1,'20051103,2,'stable')