|
Hi:
I have data like this...
DATA LIST FREE
/var1 source. BEGIN DATA. 1 1 1 1 2 1 2 1 1 2 1 2 1 2 2 2 END DATA. When I do a crosstab for var1 by source I get 3 columns, results for source = 1 and source = 2, and a third colum called total which equals col1 + col2, but what I would like to get is a colum that equals the results of source = 1 - source = 2, this is a repetitive task that I handle exporting the table to excel, but i was figuring that there could be some way to do all this with SPSS...
I´ve been trying to do it via aggregate without any success....
Any ideas...
|
|
Open a new instance of SPSS. Copy the syntax below to a syntax file.
Click <run>. Click <all>. Is this what you are looking for? Art Kendall Social Research Consultants DATA LIST FREE /var1 source. BEGIN DATA. 1 1 1 1 2 1 2 1 1 2 1 2 1 2 2 2 END DATA. compute source1 = source eq 1. compute source2 = source eq 2. formats var1 source source1 source2 (f1). sort cases by var1. DATASET DECLARE aggfile. aggregate outfile=aggfile /break = var1 /n_source1 = sum(source1) /n_source2 = sum(source2). dataset activate aggfile. compute diff = n_source1 - n_source2. formats n_source1 n_source2 diff (f4). LIST . Juan Pablo Sandoval wrote: > Hi: > > I have data like this... > > DATA LIST FREE > /var1 source. > BEGIN DATA. > 1 1 > 1 1 > 2 1 > 2 1 > 1 2 > 1 2 > 1 2 > 2 2 > END DATA. > > When I do a crosstab for var1 by source I get 3 columns, results for > source = 1 and source = 2, and a third colum called total which equals > col1 + col2, but what I would like to get is a colum that equals the > results of source = 1 - source = 2, this is a repetitive task that I > handle exporting the table to excel, but i was figuring that there > could be some way to do all this with SPSS... > > I´ve been trying to do it via aggregate without any success.... > > Any ideas... ===================== 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
Art Kendall
Social Research Consultants |
|
Art:
Yep... that what i was looking for!!!
Thank you very much...
Regards,
JPS
2009/4/26 Art Kendall <[hidden email]> Open a new instance of SPSS. Copy the syntax below to a syntax file. Click <run>. Click <all>. |
| Free forum by Nabble | Edit this page |
