|
Hello-
I'm currently outputting datasets of means of multiple variables broken by one variable(SCHNUM). I filter the main data set first by another variable, however, my question is: Is it possible to not FILTER by PRE3, as below, and BREAK by SCHNUM and PRE3 into one data set? Currently, I change the filter value to output a new dataset. USE ALL. COMPUTE filter_$=(PRE3 = 2). FORMAT filter_$ (f1.0). FILTER BY filter_$. EXECUTE . * . DATASET DECLARE AGGREGATE_ONE. SORT CASES BY SCHNUM . AGGREGATE /OUTFILE='AGGREGATE_ONE' /PRESORTED /BREAK=SCHNUM /SCHOOL_N.C=N /Q1.R1_mean.c = MEAN(Q1.R1) /Q1.R2_mean.c = MEAN(Q1.R2). EXECUTE . -Andrew ====================To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD |
|
At 12:53 PM 10/13/2008, Andrew Piskorowski wrote:
>I'm currently outputting datasets of means of multiple variables >broken by one variable(SCHNUM). I filter the main data set first by >another variable, however, my question is: Is it possible to not >FILTER by PRE3, as below, and BREAK by SCHNUM and PRE3 into one data set? Yes; it's quite easy. The /BREAK subcommand on AGGREGATE takes several variables, if desired. Your current practice gives you a dataset for, say, PRE3=2:, >USE ALL. >COMPUTE filter_$=(PRE3 = 2). >FORMAT filter_$ (f1.0). >FILTER BY filter_$. * ... (This, like most EXECUTEs, is unnecessary) ... . * xxx EXECUTE . * ... I'm deleting the SORT command and the ... . * ... /PRESORTED subcommand on AGGREGATE. ... . * ... They actually slow down the AGGREGATE ... . * ... unless you have many, many BREAK groups -- ... . * ... hundreds of thousands, at least. ... . * xxx SORT CASES BY SCHNUM . >DATASET DECLARE AGGREGATE_ONE. > >AGGREGATE > /OUTFILE='AGGREGATE_ONE' > /BREAK=SCHNUM > /SCHOOL_N.C=N > /Q1.R1_mean.c = MEAN(Q1.R1) > /Q1.R2_mean.c = MEAN(Q1.R2). * ... (This one isn't necessary, either) ... . * xxx EXECUTE . Instead, you probably want, DATASET DECLARE AGGREGATE. AGGREGATE /OUTFILE='AGGREGATE' /BREAK=PRE3 SCHNUM /SCHOOL_N.C=N /Q1.R1_mean.c = MEAN(Q1.R1) /Q1.R2_mean.c = MEAN(Q1.R2). That will group the summary records for each value of PRE3 together, with the corresponding record for each school. If you'd prefer each school's records together, for all values of PRE3, change the order on the /BREAK: DATASET DECLARE AGGREGATE. AGGREGATE /OUTFILE='AGGREGATE' /BREAK=SCHNUM PRE3 /SCHOOL_N.C=N /Q1.R1_mean.c = MEAN(Q1.R1) /Q1.R2_mean.c = MEAN(Q1.R2). -Best of luck to you, Richard ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD |
| Free forum by Nabble | Edit this page |
