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 (June 2009)Back to main SPSSX-L pageJoin or leave SPSSX-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Thu, 18 Jun 2009 15:29:23 -0700
Reply-To:     Zachary Feinstein <zsfeinstein@yahoo.com>
Sender:       "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From:         Zachary Feinstein <zsfeinstein@yahoo.com>
Subject:      Cumulative Count in Data Window Might Help
Content-Type: multipart/alternative;

Let me try to simplify my request.  And I think I found a shortcut on how to do this. I wish to create a cumulative count in my data file for the record number within the data file for the respondent.  So- for example- and let us say we have 25 respondents but four rows for each id.  Therefore the data file will have 100 records.  I want to make it so that I create a variable that is a cumulative count for a common id. So the data file would look like 1 2 3 4, 1 2 3 4... and so on down the rows in one field.  Somehow it needs to also condition on the fact that it restarts the count for each new respid.  $casenum = 1 will have respid = 1, #2 has 2, #3 has 3, #4 has 4, AND #5 has 1, and so on.... The following is what I have started to program but I just get a column of 2s if I do this.  Not only do I need it to add to the previous row but it, again, needs to re-start every 4 records. COMPUTE order = 1. COMPUTE order = (order + 1). LEAVE order. EXECUTE. Thanks a bunch! Zachary From:SPSSX(r) Discussion [mailto:SPSSX-L@LISTSERV.UGA.EDU] On Behalf Of Zachary Feinstein Sent: Wednesday, June 17, 2009 1:21 PM To: SPSSX-L@LISTSERV.UGA.EDU Subject: Trying to Simulate Selection Rules Diffiicult   The scenario is I have 1,000 respondents in a survey.  Each person is classified as having a score between 1 and 7 for some brands they rated.  They could have rated up to 15 brands total.   My job is to randomly select 4 brands that they will do followup ratings with.  Problems occur because some of the rules overlap and I think I know how to fix it but I do not know the SPSS code.   So it starts out by saying brand1 is chosen based on who had the highest score.  Only one can fit into Brand 1.   Then the algorithm starts looking at filling brand2 then brand3.  Brand 2 says to pull a certain brand but if that does not occur then use another rule.  That same rule defines the first condition for brand 3.   So, for example, the first rule for 2 might say to pull any brand that is a 5 or 6, but if they do not exist then pull a 3 or 4 and submit that instead to brand 2.   But brand 3 is to first try to pull 3 or 4 but the problem is that I want to remove any responses (not cases) selected from brand 2 from the pool before I get to brand 3.   To visualize this I am also submitting one respondent from a stacked dataset below.  They are no. 1291.  I broke brand2 into 2 different fields.  One is called brand2_1 and the next one is called brand2_2.  No-one qualified to rate the brands based on the first Brand 2 definition but many did based on the 2nd one.  What I need to learn to program is if I pull the first response off of brand2_2 then I want to remove that same first response from brand3_1.  I am using AGGREGATE with the FIRST() functionality to pull the first instance I find for each of the listed fields.  So ideally the first for each.  If I can get the program to work it would be 3-1-5-2.  The 5 is pulled because I somehow got rid of the first 1 there because it was selected for Brand2.   Any and all help is highly valued and appreciated.   Zachary zsfeinstein@yahoo.com (651) 698-2184   RESPID brand brand1 brand2_1 brand2_2 brand3_1 brand3_2 brand4 1291 . 3 . . . . . 1291 1 . . 1 1 . . 1291 5 . . 5 5 . . 1291 7 . . 7 7 . . 1291 10 . . 10 10 . . 1291 12 . . 12 12 . . 1291 13 . . 13 13 . . 1291 14 . . 14 14 . . 1291 6 . . . . 6 . 1291 8 . . . . 8 . 1291 2 . . . . . 2 1291 4 . . . . . 4 1291 9 . . . . 9 . 1291 11 . . . . . . 1291 15 . . . . . .


[text/html]


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