add a correlative number in secuence

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

add a correlative number in secuence

ANDRES ALBERTO BURGA LEON

Hello to everybody:
 
I have diferent data file, with diferent numbre of cases (from 400 to 5000).
 
I need to add a consecutive number (wich could be diferent each time) in secuence to the cases, sometink like:
 
 
cod_barra codificador
6P17190 1
6P17192 2
6P17196 3
6P17205 4
6P17182 5
6P17204 6
6P17151 7
6P17149 8
6P17064 9
6P17066 10
6P17191 1
6P17151 2
6P17067 3
6P17156 4
6P17159 5
6P17161 6
6P32173 7
6P32165 8
6P17154 9
6P17149 10
6P17193 1
6P17217 2
6P17154 3
6P17067 4
6P17158 5
6P17162 6
6P17160 7
 
My data file has the variable cod_barra, I need to create the codificador variable.
 
Thank you very much for the help.
 
 
 
====================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
Reply | Threaded
Open this post in threaded view
|

Re: add a correlative number in secuence

vlad simion
hi,

if you only need to count an id variable from 1 to 10, use something like this:

compute codificador=mod($casenum-1,10)+1. 
exe.


hth,
vlad 


On Wed, Jan 16, 2013 at 4:53 PM, ANDRES ALBERTO BURGA LEON <[hidden email]> wrote:

Hello to everybody:
 
I have diferent data file, with diferent numbre of cases (from 400 to 5000).
 
I need to add a consecutive number (wich could be diferent each time) in secuence to the cases, sometink like:
 
 
cod_barra codificador
6P17190 1
6P17192 2
6P17196 3
6P17205 4
6P17182 5
6P17204 6
6P17151 7
6P17149 8
6P17064 9
6P17066 10
6P17191 1
6P17151 2
6P17067 3
6P17156 4
6P17159 5
6P17161 6
6P32173 7
6P32165 8
6P17154 9
6P17149 10
6P17193 1
6P17217 2
6P17154 3
6P17067 4
6P17158 5
6P17162 6
6P17160 7
 
My data file has the variable cod_barra, I need to create the codificador variable.
 
Thank you very much for the help.
 
 
 
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

Reply | Threaded
Open this post in threaded view
|

Automatic reply: add a correlative number in secuence

Dittfurth, Monica

I will be out of the office until Monday, January 21st. If you have an urgent need or request before I return, please email [hidden email].

 

Thanks,

Monica

 

Reply | Threaded
Open this post in threaded view
|

Re: add a correlative number in secuence

John F Hall
In reply to this post by ANDRES ALBERTO BURGA LEON

It’s not clear what you want, but if you want consective IDs try:

 

Compute id = $casenum.

 

This takes the row number for each case and inserts it as a new variable appended to the end of the file.  You can move it to the top of the file by holding the left key down over the row number and dragging it.

 

 

John F Hall (Mr)

[retired academic survey researcher]

 

Email:     [hidden email]

Website: www.surveyresearch.weebly.com

 

 

 

 

From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of ANDRES ALBERTO BURGA LEON
Sent: 16 January 2013 15:53
To: [hidden email]
Subject: add a correlative number in secuence

 


Hello to everybody:

 

I have diferent data file, with diferent numbre of cases (from 400 to 5000).

 

I need to add a consecutive number (wich could be diferent each time) in secuence to the cases, sometink like:

 

 

cod_barra

codificador

6P17190

1

6P17192

2

6P17196

3

6P17205

4

6P17182

5

6P17204

6

6P17151

7

6P17149

8

6P17064

9

6P17066

10

6P17191

1

6P17151

2

6P17067

3

6P17156

4

6P17159

5

6P17161

6

6P32173

7

6P32165

8

6P17154

9

6P17149

10

6P17193

1

6P17217

2

6P17154

3

6P17067

4

6P17158

5

6P17162

6

6P17160

7

 

My data file has the variable cod_barra, I need to create the codificador variable.

 

Thank you very much for the help.

 

 

 

======= 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

Reply | Threaded
Open this post in threaded view
|

Re: add a correlative number in secuence

ANDRES ALBERTO BURGA LEON
Thank you,
 
Vlad sintax solves my problem



-----"SPSSX(r) Discussion" <[hidden email]> escribió: -----
Para: [hidden email]
De: John F Hall
Enviado por: "SPSSX(r) Discussion"
Fecha: 16/01/2013 13:16
Asunto: Re: add a correlative number in secuence

It’s not clear what you want, but if you want consective IDs try:

 

Compute id = $casenum.

 

This takes the row number for each case and inserts it as a new variable appended to the end of the file.  You can move it to the top of the file by holding the left key down over the row number and dragging it.

 

 

John F Hall (Mr)

[retired academic survey researcher]

 

Email:     [hidden email]

Website: www.surveyresearch.weebly.com

 

 

 

 

From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of ANDRES ALBERTO BURGA LEON
Sent: 16 January 2013 15:53
To: [hidden email]
Subject: add a correlative number in secuence

 


Hello to everybody:

 

I have diferent data file, with diferent numbre of cases (from 400 to 5000).

 

I need to add a consecutive number (wich could be diferent each time) in secuence to the cases, sometink like:

 

 

cod_barra

codificador

6P17190

1

6P17192

2

6P17196

3

6P17205

4

6P17182

5

6P17204

6

6P17151

7

6P17149

8

6P17064

9

6P17066

10

6P17191

1

6P17151

2

6P17067

3

6P17156

4

6P17159

5

6P17161

6

6P32173

7

6P32165

8

6P17154

9

6P17149

10

6P17193

1

6P17217

2

6P17154

3

6P17067

4

6P17158

5

6P17162

6

6P17160

7

 

My data file has the variable cod_barra, I need to create the codificador variable.

 

Thank you very much for the help.

 

 

 

======= 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

====================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