Wednesday 7 March 2007

Aggregate

Well, why do we need this command... Basically to collaspe a data file on the basis of one or some variables!! So, in other words if you have an individual level file, and you have community or household information in that file, you can AGGREGATE that file into a household/community file by using the id variables, and of course some common sense/research questions in selecting how to collapse the individual level characteristics on a bigger level.. What makes sense!!!

Aggregate helps perform some mathmetical functions on variables, for all the records, at an aggregate level. for example, you cannot use syntex to ADD all the beds given in a numeric variable called BEDS, for all CASES. Nor can you pick mean, median, max, min etc. values, just across all the CASES!! So, if you understand this concept you can go ahead and perform the AGGREGATE commad on your data file. I NEED AN EXPERT TO GIVE MORE DETAILS!!!

Here is the syntex:

****the vars used in BREAK get included automatically in the outfile'***.

1) Get the file to aggregate
2) give command:

AGGREGATE
/OUTFILE='NEW FILE NAME WITH PATH.sav'
/BREAK= INDEX VARIABLES
/VAR1 OR NEWLY ASSIGNED NAME*=FIRST (VAR1)
/VAR2 =MAX (VAR2)
/VAR3 =LAST (VAR3)
/VAR4 =MIN (VAR4)
/VAR5 =SD (VAR5)
/VAR6 =SUM (VAR6)
/VAR7 =MEAN (VAR7)
/VAR8 =MEDIAN (VAR8).
* for all variables
**It is obvious that the mathmatical functions make sense only for continous variables, for catagorical variable use first, last, min, and max.

3) Get the new file.

No comments: