I'm trying to count occasions in a database and just not getting there.
I've tried with LOOP and LAG and almost get it but not 100%. My data is in the 1st column below - I want to compute the second column. Any assistance will be appreciated. Column 1 Column 2 1 1 1 2 1 3 2 1 2 2 3 1 3 2 3 3 3 4 3 5 Assume that column 1 will be sorted. Everytime column 1 changes the counts in column 2 starts from 1. The number of times a number is repeated in column 1 is variable. Regards Mark |
Mark,
If your variable is called col01, then try this syntax: COMPUTE CASE=$CASENUM. RANK case BY col01 /RANK INTO col02. EXECUTE. Greetings Frederic Frederic Villamayor, BS Researcher Biostatistics Unit Juan de Sada, 32 08028 Barcelona Tel +34 935093236 Fax +34 934112764 [hidden email] http://www.ferrergrupo.com Este mensaje, y en su caso, cualquier fichero anexo al mismo, puede contener información confidencial, siendo para uso exclusivo del destinatario, quedando prohibida su divulgación, copia o distribución a terceros sin la autorización expresa del remitente. Si Vd. ha recibido este mensaje erróneamente, se ruega lo notifique al remitente y proceda a su borrado. Gracias por su colaboración. This message and its annexed files may contain confidential information which is exclusively for the use of the addressee. It is strictly forbidden to distribute copies to third parties without the explicit permission of the sender. If you receive this message by mistake, please notify it to the sender and make sure to delete it. Thank you for your kind cooperation. Mark Webb <[hidden email]> Enviado por: "SPSSX(r) Discussion" <[hidden email]> 20/04/2007 10:41 Por favor, responda a Mark Webb <[hidden email]> Para [hidden email] cc Asunto [SPSSX-L] Counting occasions in a data set. I'm trying to count occasions in a database and just not getting there. I've tried with LOOP and LAG and almost get it but not 100%. My data is in the 1st column below - I want to compute the second column. Any assistance will be appreciated. Column 1 Column 2 1 1 1 2 1 3 2 1 2 2 3 1 3 2 3 3 3 4 3 5 Assume that column 1 will be sorted. Everytime column 1 changes the counts in column 2 starts from 1. The number of times a number is repeated in column 1 is variable. Regards Mark |
Free forum by Nabble | Edit this page |