This is a small data set I have been working on and would appreciate any
ideas for a problem I have. The data has been created simply to experiment on while I get the code worked out, if possible. student course Subject Fee Cap prop CIT1 22081VIC Sub1 500 5000.0 .54 CIT1 22081VIC Sub2 1000 5000.0 .54 CIT1 22081VIC Sub3 1000 5000.0 .54 CIT1 22081VIC Sub4 200 5000.0 .54 The data consists of the first 4 vars only. Cap comes from another source, and I used MATCH FILES to introduce the value matching on course. Prop was calculated earlier too, and is the proportion of the sum of Fee/Cap (for each student-course aggregation). My data set consists of only these 4 records at the moment. The data will eventually hold records of other students in courses where the value of prop will vary. My project is that if the value of prop for any student-course combination is greater than 0.4 it indicates a problem to me. What I was hoping to do was put a running total into a variable (x), but I don’t know how to do that. (I’ve stuck in a couple of columns at the end for x and y to demonstrate my thinking.) student course Subject Fee Cap prop x y CIT1 22081VIC Sub1 500 5000.0 .54 500 .1 CIT1 22081VIC Sub2 1000 5000.0 .54 1500 .3 CIT1 22081VIC Sub3 1000 5000.0 .54 2500 .5 CIT1 22081VIC Sub4 200 5000.0 .54 2700 .54 Once X is present it would be easy to calculate a running proportion (y). If I had x and y I would be able to create two new output files. The aim on all of this is to do the following: Records get written to File A if the sum of fees (y) is less than or equal to 0.4, with the remaining records getting written to File B. So, in the above example, the first two records will end up in File A and the last two will end up in File B. I can't aggregate the output. The records that end up in File A and File B must be identical to the source; If I start with 4 records, then the total of File A and B must also be 4 records. Perhaps I'm going about this in the wrong way, your suggestions would be welcome. -- Sent from: http://spssx-discussion.1045642.n5.nabble.com/ ===================== 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 |
And then it dawned on me.....
compute caseno = $casenum. do if (caseno eq 1). + compute y = x. else. + compute y = x + lag(y). end if. I'm happy again! -- Sent from: http://spssx-discussion.1045642.n5.nabble.com/ ===================== 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 |
Administrator
|
Look also at the CSUM function in CREATE command .
Note: CREATE respects SPLIT FILE. -- Ron0z wrote > And then it dawned on me..... > > compute caseno = $casenum. > do if (caseno eq 1). > + compute y = x. > else. > + compute y = x + lag(y). > end if. > > I'm happy again! > > > > -- > Sent from: http://spssx-discussion.1045642.n5.nabble.com/ > > ===================== > To manage your subscription to SPSSX-L, send a message to > LISTSERV@.UGA > (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 ----- Please reply to the list and not to my personal email. Those desiring my consulting or training services please feel free to email me. --- "Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis." Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?" -- Sent from: http://spssx-discussion.1045642.n5.nabble.com/ ===================== 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
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me. --- "Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis." Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?" |
Free forum by Nabble | Edit this page |