Presentation is loading. Please wait.

Presentation is loading. Please wait.

Processing Grouped Data

Similar presentations


Presentation on theme: "Processing Grouped Data"— Presentation transcript:

1 Processing Grouped Data
HRP223 – 2010 November 9th, 2010 Copyright © Leland Stanford Junior University. All rights reserved. Warning: This presentation is protected by copyright law and international treaties. Unauthorized reproduction of this presentation, or any portion of it, may result in severe civil and criminal penalties and will be prosecuted to maximum extent possible under the law.

2 Analysis Procedures by…
You may need to work on groups of subjects (or other things). That is, you want to organize your data by some grouping variable. Most analysis procedures will let you do this easily.

3 Means by Group does not need to be sorted
if the data is already sorted

4 Summary Statistics

5 Complicated Processing by Group
Say you want to get the first or last element in a sorted list. Sort the data if needed. Include a by THING statement in a data step. Use the automatically created first.THINGY and/or last.THING variables Automatically make first.act and last.act variables. Set first.act = 1 on first record of an act group of records and last.act = 1 on last record of the groups. 1 = true in a logic check

6 Complex Running Totals
Say you want to get the average radiation from the first two chest x-rays that a patient receives and the visits are not in order. Sort the data by patient and date. In a data step: Set a visit counter to 0 on first visit. Add one for every subsequent visit. Keep the records where visit < 3.

7 Many Ways to Sort Choose the Filter and Sort, the Query Builder or the Data > Sort Data… context sensitive menus.

8 The PDV does not remember the old values.
Once the data is subsetted and ordered, use a data step and process by the subject ID. The PDV does not remember the old values. data firstTwo; set sorted; by dude; if first.dude then visit = 1; else visit = visit + 1; run;

9


Download ppt "Processing Grouped Data"

Similar presentations


Ads by Google