LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (April 2000)Back to main SPSSX-L pageJoin or leave SPSSX-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Tue, 4 Apr 2000 20:04:14 -0400
Reply-To:     Raynald Levesque <rlevesque@VIDEOTRON.CA>
Sender:       "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From:         Raynald Levesque <rlevesque@VIDEOTRON.CA>
Subject:      Re: Finding Median for subset of Records
Content-type: text/plain; charset=iso-8859-1

You may find the following useful (It was posted by David Marso to the newsgroup comp.soft-sys.stat.spss some time ago.)

How to aggregate with the median:

GET FILE='C:\Program Files\SPSS\1991 U.S. General Social Survey.sav'. * A LITTLE TRICK TO BE SURE RMV HAS SOMETHING TO RMV TO * . SORT CASES BY occcat80. MATCH FILES FILE * / BY OCCCAT80 / FIRST=TOP. DO IF TOP. XSAVE OUTFILE "FILL.SAV" / KEEP occcat80. END IF. EXECUTE. ADD FILES / FILE "FILL.SAV" / FILE * /IN=MED_DEV/ BY OCCCAT80.

SPLIT FILE BY OCCCAT80. PRESERVE .

* HERE IS THE MAIN TRICK NOTE A LIST OF VARIABLES MAY BE USED WITH RMV * . SET RESULTS=OFF. RMV MED_AGE=MEDIAN(AGE,ALL).

** In THIS CASE I "match" the median and difference all appropriate cases **. ** YOU COULD JUST SELECT IF NOT(MED_AGE) to get your "Aggregate" File: .

IF MED_DEV MED_AGE=LAG(MED_AGE). COMPUTE MED_DEV=AGE-MED_AGE. EXE.

*CLEAN UP * . SELECT IF NOT TOP. MATCH FILES FILE * / DROP TOP. EXECUTE. RESTORE .

HTH

Raynald Levesque rlevesque@videotron.ca ----- Original Message ----- From: Dan Heuman <DANH@POLK.CA> Newsgroups: bit.listserv.spssx-l To: <SPSSX-L@LISTSERV.UGA.EDU> Sent: Tuesday, April 04, 2000 12:36 PM Subject: Finding Median for subset of Records

> I basically need a way of doing an Aggregate command and return the median > for each break variable. Aggregate doesn't have median as an option. I > could do a split file of the break variable and run frequencies but that > won't save the results to a data table. Am I missing something? Is there a > way to do this? > > Thanks, > > Danny Heuman > danh@polk.ca


Back to: Top of message | Previous page | Main SPSSX-L page