Create new variable equal to number of occurrences of var1
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | * To add a variable which contains the number of occurences of the value of var1. * Thus with the following data, we want n=2 for cases where var1=25 and n=3 for cases where var1=10. DATA LIST LIST /var1(F8). BEGIN DATA. 25 10 10 25 10 END DATA. LIST. SORT CASES BY var1. SAVE OUTFILE='c:\\temp\\temp.sav'. AGGREGATE /OUTFILE=* /BREAK=var1 /N_BREAK=N. MATCH FILES /TABLE=* /FILE='c:\\temp\\temp.sav' /BY var1. EXECUTE. |
Related pages
...