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 (May 1998)Back to main SPSSX-L pageJoin or leave SPSSX-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Thu, 28 May 1998 11:11:47 -0500
Reply-To:     "Tverdek, Edward" <etverdek@SPSS.COM>
Sender:       "SPSSX(r) Discussion" <SPSSX-L@UGA.CC.UGA.EDU>
From:         "Tverdek, Edward" <etverdek@SPSS.COM>
Subject:      Re: how to use table cell info in syntax
Comments: To: Gonzalo Kmaid <gkmaid@INTERNET.COM.UY>


The CROSSTABS procedure has a WRITE subcommand available in command syntax which, in combination with the PROCEDURE OUTPUT command, can write the cell counts to a text file. This file can be read back into SPSS and merged with your original data through a table look-up MATCH for further processing.

In your case, however, I think it might be easier to avoid producing contingency tables altogether and to determine the joint frequency counts for each combination of age, sex, and region through the AGGREGATE procedure. If you BREAK on each of these variables and ask for the number of cases within each break group, SPSS will return a file with as many cases are there are unique combinations of the values (i.e. the number of cells you would have across your layered tables). You can then use MATCH FILES (Data...Merge Files...Add Variables on the menus), assigning age, sex, and region as your key variables and, again, treating the aggregated outfile as a TABLE to assign the "cell counts" back to each case on your original file. Thus for each case, you'll have a new variable which represents the count of whichever cell it would fall into had you actually done Crosstabs. You can then divide this variable by the total number of cases to generate the weighting variable you describe.

I hope I've understood your question and that these suggestions are useful,

Ed Tverdek SPSS Technical Support

>-----Original Message----- >From: Gonzalo Kmaid [SMTP:gkmaid@INTERNET.COM.UY] >Sent: Thursday, May 28, 1998 9:59 AM >To: SPSSX-L@UGA.CC.UGA.EDU >Subject: how to use table cell info in syntax > >Hi All, > >I would like to use the particular values obtained in a crosstab table to >create a new var to be used to weight a particular sample. The weighting >variable is always defined the same way. So life would be less tedious if >that can be done automatically. The situation is as follows: > >Usually I produce a crosstab between age and sex controlling by region >(three, two, and two groups respectively). > >Then, >1. I compute the actual proportion of cases in each cell with respect to >the total sample size (by hand). > >2. Elswhere, I have the real value for each cell combination (population >distribution value for region equal 0, sex equal 0 and age equal 0 and so >on). Therefore, each factor weight is equal to the population cell value >divided the sample proportion calculated in 1. > >Through a series of if statements I create the weighting variable > >if ((age eq 0 and sex eq 1) and region eq 0) peso1=x.xxxx >if ((age eq 1 and sex eq 0) and region eq 1) peso1=z.zzzz >etc. >etc. > >Where is the result of 2 (same for the rest of statements) > >What I would like to do is to tell spss to divide each cell value over the >sample size, and then use these numbers to calculate each factor weight >score, and then write them into the series of if statements. Any hint on >how to acomplish this? Any reference to check? TIA > > >Gonzalo Kmaid > > >Gonzalo Kmaid > >Carlos Maria Morales 944/801 >Montevideo-URUGUAY

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