LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous (more recent) messageNext (less recent) messagePrevious (more recent) in topicNext (less recent) in topicPrevious (more recent) by same authorNext (less recent) by same authorPrevious page (July 2008)Back to main SPSSX-L pageJoin or leave SPSSX-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Sat, 5 Jul 2008 22:36:52 -0300
Reply-To:     Hector Maletta <hmaletta@fibertel.com.ar>
Sender:       "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From:         Hector Maletta <hmaletta@fibertel.com.ar>
Comments: To: Charley Trimble <charleytrimble@sbcglobal.net>
In-Reply-To:  <961160.9897.qm@web83603.mail.sp1.yahoo.com>
Content-Type: text/plain; charset="iso-8859-1"

I think, Charley, you are approaching this the wrong way. I imagine your original data set has only the first five variables (emp, id, c_zip, cz_city, and sales$. This master file could be handled in many ways to generate output tables and/or partial files concerning sales by particular employees, or sales in a particular city, or whatever combination you may fancy. You don't actually need to create different variables for sales in Dallas, sales in Miami and so on. So it all depends on what you actually need. If you need output tables showing total sales by salesmen in Dallas, you may generate them quite easily. You may also need total sales by city, or whatever. For things like these, you do not need new variables: you just order the tables you need. For instance: MEANS SALES$ BY CZ_CITY BY EMP /CELLS SUM. This generates a table showing total sales for each employee in each city. Besides the sum, you may ask for the mean, the maximum and minimum sale, the standard deviation, and several other measures regarding the sales of each employee in each city. You may also omit the employee by stating only MEANS SALES$ BY CZ_CITY/CELLS SUM. If you omit the CELLS SUM subcommand, the default statistics for each cell are the mean, the std deviation and the number of cases. Other commands are available, such as custom tables, which require specific modules outside the Base system, and give you more possibilities.

Hector

-----Original Message----- From: SPSSX(r) Discussion [mailto:SPSSX-L@LISTSERV.UGA.EDU] On Behalf Of Charley Trimble Sent: 05 July 2008 20:18 To: SPSSX-L@LISTSERV.UGA.EDU Subject:

Help, please.

I'm wanting to create new variables for each defined geographical area (a combination zip code_city description thru a variable named cz_city below) that ties individual sales to the zip code_city location of each customer and which also tags the corresponding employee (emp) handling the sale. The listing below, for example, creates three new variables (z12345_Dallas, z77239_Miami, and z24596_Pittsb), which reveal the location of the sale by zip code_city, the amount of dollarsales (sales$), and the employee responsible for garnering the sales. The syntax for creating these three variables is listed below, as well.

With that said, there may be, in reality, as many as 500-600 zip codes by state and, what is more, the number of individual sales by employee may be in the millions.

How can I create new variables without going through the graphical user interface of SPSS for each and every COMPUTE and IF command for each zip code_city variable? Note the zip codes in the illustration below are imaginary but I do, nonetheless, have all of the zip codes in the U.S. and have matched them with the corresponding city name, e.g. z77239_Miami to create the cz_city variable. The question is how can I more quickly create these variables?

Can someone please educate me on the syntax required to create these new zvariables, as well as the corresonding sysmis commands, which are also singularly noted below? Thank you very, very much. Charley Trimble

emp id c_zip cz_city sales$ z12345_Dallas z77233_Miami z24596_Pittsb Bob 100 12345 z12345_Dallas 4423.13 4423.13 .00 .00 Bob 100 12345 z12345_Dallas 3952.12 3952.12 .00 .00 Bob 200 77233 z77233_Miami 2100.19 .00 2100.19 .00 Bob 300 24596 z24596_Pittsb 2129.74 .00 .00 2129.74 Sally 100 24596 z24596_Pittsb 2998.24 .00 .00 2998.24 Sally 300 12345 z12345_Dallas 3219.80 3219.80 .00 .00 Susan 200 77233 z77233_Miami 4290.04 .00 4290.04 .00 Susan 200 12345 12345_Dallas 5679.49 5679.49 .00 .00

Number of cases read: 8 Number of cases listed: 8

IF (c_zip = 12345) z12345_Dallas=sales$. VARIABLE LABELS z12345_Dallas 'z12345 Dallas'.

IF (c_zip = 77233) z77233_Miami=sales$. VARIABLE LABELS z77233_Miami 'Miami Sales'.

IF (c_zip = 24596) z24596_Pittsb=sales$. VARIABLE LABELS z24596_Pittsb 'Pittsburgh sales'. EXECUTE.

if (sysmis (z12345_Dallas)) z12345_Dallas = 0. if (sysmis (z77233_Miami)) z77233_Miami = 0. if (sysmis (z24596_Pittsb)) z24596_Pittsb = 0. EXECUTE .

To manage your subscription to SPSSX-L, send a message to LISTSERV@LISTSERV.UGA.EDU (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

===================== To manage your subscription to SPSSX-L, send a message to LISTSERV@LISTSERV.UGA.EDU (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


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