Hi Everyone,
I have an SPSS problem with which you may be able to help me. Here it goes: I have a large data file which is configured similar to the example I give below: MCD_N Month Crime_Type N_Crime Avondale 10 Robbery 9 - - Murder 2 - - Burglary 25 - 11 Burglary 30 - - DrugPos 120 Bedminister 01 Aggr Assault 50 - - Robbery 20 Note that the dashes do not appear in the data set. I included them in this example as place holders, for ease of interpretation. Questions: How do I write a syntax (or series of codes) to fill in the blanks were appropriate? Thus, how do I write a syntax (or series of codes) that will configure my data file in the following way: MCD_N Month Crime_Type N_Crime Avondale 10 Robbery 9 Avondale 10 Murder 2 Avondale 10 Burglary 25 Avondale 11 Burglary 30 Avondale 11 DrugPos 120 Bedminister 01 Aggr Assault 50 Bedminister 01 Robbery 20 I would appreciate any help you may be able to provide. Thank you in advance, Vincent |
At 12:07 PM 1/18/2007, Vincent Louis wrote:
>I have a large data file which is configured similar to the example I >give below: > >MCD_N Month Crime_Type N_Crime > >Avondale 10 Robbery 9 > - - Murder 2 > - - Burglary 25 > - 11 Burglary 30 > - - DrugPos 120 >Bedminister 01 Aggr Assault 50 > - - Robbery 20 > >Note that the dashes do not appear in the data set. I included them in >this example as place holders, for ease of interpretation. > >Questions: How do I write a syntax (or series of codes) to fill in the >blanks were appropriate? You don't say what to fill them in WITH, but it looks like if a value is blank, you want the value from the preceding record. That's child's play, but the code below is untested. It assumes Month is a character variable, though that practice is to be avoided. By the way, did you ever take care of the problem we gave so much attention to, under thread name "Help using vectors and loops", back in October? IF MCD_N EQ ' ' MCD_N = LAG(MCD_N). IF Month EQ ' ' Month = LAG(Month). >Thus, how do I write a syntax (or series of codes) that will configure >my data file in the following way: > >MCD_N Month Crime_Type N_Crime > >Avondale 10 Robbery 9 >Avondale 10 Murder 2 >Avondale 10 Burglary 25 >Avondale 11 Burglary 30 >Avondale 11 DrugPos 120 >Bedminister 01 Aggr Assault 50 >Bedminister 01 Robbery 20 > >I would appreciate any help you may be able to provide. > >Thank you in advance, >Vincent > > > >-- >No virus found in this incoming message. >Checked by AVG Free Edition. >Version: 7.5.432 / Virus Database: 268.16.12/631 - Release Date: >1/16/2007 8:25 AM |
Free forum by Nabble | Edit this page |