Finding the value from different set of variables

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

Finding the value from different set of variables

Manoj Arora (DEL/Abacus Analytics)

Hi,

 

I have 43 set of variables like v1_1_1 to v1_1_10, v1_2_1 to v1_2_10, v1_3_1 to v1_3_10 and so on  v1_43_1 to v1_43_10 and all these variable contains value from 1 to 10. I want to generate 43 new variables for value 5 & value 7.

 

I want to generate variables nv5_1 to nv5_43 will contain the value 5 and nv7_1 to nv7_43 with value 7.  I tried to solve this using vector command but could not solve it.

 

Thanks

Manoj

 

 

 



Kantar Disclaimer ===================== 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: Finding the value from different set of variables

David Marso
Administrator
You don't provide any context or the syntax you tried.
This couldn't possibly be what you want but please reread your question and give yourself a much deserved face-palm!

DO REPEAT v=nv5_1 to nv5_43 .
COMPUTE v=5.
END REPEAT.
I think you can sort out what is needed for 7.
BUT, why would you want to set up something like this.
Seems like a waste of storage and  a silly data management concept at work here.

Manoj Arora (DEL/Abacus Analytics) wrote
Hi,

I have 43 set of variables like v1_1_1 to v1_1_10, v1_2_1 to v1_2_10, v1_3_1 to v1_3_10 and so on  v1_43_1 to v1_43_10 and all these variable contains value from 1 to 10. I want to generate 43 new variables for value 5 & value 7.

I want to generate variables nv5_1 to nv5_43 will contain the value 5 and nv7_1 to nv7_43 with value 7.  I tried to solve this using vector command but could not solve it.

Thanks
Manoj





Kantar Disclaimer<http://www.kantar.com/disclaimer.html>

=====================
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?"
Reply | Threaded
Open this post in threaded view
|

Re: Finding the value from different set of variables

Muthukkumaran(CHN/ANALYSIS)
In reply to this post by Manoj Arora (DEL/Abacus Analytics)

Hi,

 

Find below the syntax .

 

vector  v5_(43).

vector v=v5_1 to v5_43.

vector   vx1         =             v1_1_1 to           v1_1_10.

vector   vx2         =             v1_2_1 to           v1_2_10.

vector   vx3         =             v1_3_1 to           v1_3_10.

vector   vx4         =             v1_4_1 to           v1_4_10.

vector   vx5         =             v1_5_1 to           v1_5_10.

vector   vx6         =             v1_6_1 to           v1_6_10.

vector   vx7         =             v1_7_1 to           v1_7_10.

vector   vx8         =             v1_8_1 to           v1_8_10.

vector   vx9         =             v1_9_1 to           v1_9_10.

vector   vx10       =             v1_10_1               to           v1_10_10.

vector   vx11       =             v1_11_1               to           v1_11_10.

vector   vx12       =             v1_12_1               to           v1_12_10.

vector   vx13       =             v1_13_1               to           v1_13_10.

vector   vx14       =             v1_14_1               to           v1_14_10.

vector   vx15       =             v1_15_1               to           v1_15_10.

vector   vx16       =             v1_16_1               to           v1_16_10.

vector   vx17       =             v1_17_1               to           v1_17_10.

vector   vx18       =             v1_18_1               to           v1_18_10.

vector   vx19       =             v1_19_1               to           v1_19_10.

vector   vx20       =             v1_20_1               to           v1_20_10.

vector   vx21       =             v1_21_1               to           v1_21_10.

vector   vx22       =             v1_22_1               to           v1_22_10.

vector   vx23       =             v1_23_1               to           v1_23_10.

vector   vx24       =             v1_24_1               to           v1_24_10.

vector   vx25       =             v1_25_1               to           v1_25_10.

vector   vx26       =             v1_26_1               to           v1_26_10.

vector   vx27       =             v1_27_1               to           v1_27_10.

vector   vx28       =             v1_28_1               to           v1_28_10.

vector   vx29       =             v1_29_1               to           v1_29_10.

vector   vx30       =             v1_30_1               to           v1_30_10.

vector   vx31       =             v1_31_1               to           v1_31_10.

vector   vx32       =             v1_32_1               to           v1_32_10.

vector   vx33       =             v1_33_1               to           v1_33_10.

vector   vx34       =             v1_34_1               to           v1_34_10.

vector   vx35       =             v1_35_1               to           v1_35_10.

vector   vx36       =             v1_36_1               to           v1_36_10.

vector   vx37       =             v1_37_1               to           v1_37_10.

vector   vx38       =             v1_38_1               to           v1_38_10.

vector   vx39       =             v1_39_1               to           v1_39_10.

vector   vx40       =             v1_40_1               to           v1_40_10.

vector   vx41       =             v1_41_1               to           v1_41_10.

vector   vx42       =             v1_42_1               to           v1_42_10.

vector   vx43       =             v1_43_1               to           v1_43_10.

 

do repeat vec = vx1 to vx43 / cnt =1 to 43.                                                                           

loop #i=1 to 10.

do if vec(#i)=5.

compute v(cnt)=vec(#i).

end if.

end loop.

end repeat.

execute.

 

do repeat vec = vx1 to vx43 / cnt =1 to 43.                                                                           

loop #i=1 to 10.

do if vec(#i)=7.

compute v(cnt)=vec(#i).

end if.

end loop.

end repeat.

execute.

 

From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Arora, Manoj (IMDLR)
Sent: Wednesday, July 22, 2015 2:03 PM
To: [hidden email]
Subject: Finding the value from different set of variables

 

Hi,

 

I have 43 set of variables like v1_1_1 to v1_1_10, v1_2_1 to v1_2_10, v1_3_1 to v1_3_10 and so on  v1_43_1 to v1_43_10 and all these variable contains value from 1 to 10. I want to generate 43 new variables for value 5 & value 7.

 

I want to generate variables nv5_1 to nv5_43 will contain the value 5 and nv7_1 to nv7_43 with value 7.  I tried to solve this using vector command but could not solve it.

 

Thanks

Manoj

 

 

 



Kantar Disclaimer

===================== 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
Reply | Threaded
Open this post in threaded view
|

Re: Finding the value from different set of variables

David Marso
Administrator
So perhaps take another crack at describing the purpose/intention of this code?
What do you want to achieve from this.
Perhaps a simple whittled down example of inputs and desired output would be
useful to illustrate the mapping?
Just guessing that the face-palm didn't take?
---
Muthukkumaran(CHN/ANALYSIS) wrote
Hi,

Find below the syntax .

vector  v5_(43).
vector v=v5_1 to v5_43.
vector   vx1         =             v1_1_1 to           v1_1_10.
vector   vx2         =             v1_2_1 to           v1_2_10.
vector   vx3         =             v1_3_1 to           v1_3_10.
vector   vx4         =             v1_4_1 to           v1_4_10.
vector   vx5         =             v1_5_1 to           v1_5_10.
vector   vx6         =             v1_6_1 to           v1_6_10.
vector   vx7         =             v1_7_1 to           v1_7_10.
vector   vx8         =             v1_8_1 to           v1_8_10.
vector   vx9         =             v1_9_1 to           v1_9_10.
vector   vx10       =             v1_10_1               to           v1_10_10.
vector   vx11       =             v1_11_1               to           v1_11_10.
vector   vx12       =             v1_12_1               to           v1_12_10.
vector   vx13       =             v1_13_1               to           v1_13_10.
vector   vx14       =             v1_14_1               to           v1_14_10.
vector   vx15       =             v1_15_1               to           v1_15_10.
vector   vx16       =             v1_16_1               to           v1_16_10.
vector   vx17       =             v1_17_1               to           v1_17_10.
vector   vx18       =             v1_18_1               to           v1_18_10.
vector   vx19       =             v1_19_1               to           v1_19_10.
vector   vx20       =             v1_20_1               to           v1_20_10.
vector   vx21       =             v1_21_1               to           v1_21_10.
vector   vx22       =             v1_22_1               to           v1_22_10.
vector   vx23       =             v1_23_1               to           v1_23_10.
vector   vx24       =             v1_24_1               to           v1_24_10.
vector   vx25       =             v1_25_1               to           v1_25_10.
vector   vx26       =             v1_26_1               to           v1_26_10.
vector   vx27       =             v1_27_1               to           v1_27_10.
vector   vx28       =             v1_28_1               to           v1_28_10.
vector   vx29       =             v1_29_1               to           v1_29_10.
vector   vx30       =             v1_30_1               to           v1_30_10.
vector   vx31       =             v1_31_1               to           v1_31_10.
vector   vx32       =             v1_32_1               to           v1_32_10.
vector   vx33       =             v1_33_1               to           v1_33_10.
vector   vx34       =             v1_34_1               to           v1_34_10.
vector   vx35       =             v1_35_1               to           v1_35_10.
vector   vx36       =             v1_36_1               to           v1_36_10.
vector   vx37       =             v1_37_1               to           v1_37_10.
vector   vx38       =             v1_38_1               to           v1_38_10.
vector   vx39       =             v1_39_1               to           v1_39_10.
vector   vx40       =             v1_40_1               to           v1_40_10.
vector   vx41       =             v1_41_1               to           v1_41_10.
vector   vx42       =             v1_42_1               to           v1_42_10.
vector   vx43       =             v1_43_1               to           v1_43_10.

do repeat vec = vx1 to vx43 / cnt =1 to 43.
loop #i=1 to 10.
do if vec(#i)=5.
compute v(cnt)=vec(#i).
end if.
end loop.
end repeat.
execute.

do repeat vec = vx1 to vx43 / cnt =1 to 43.
loop #i=1 to 10.
do if vec(#i)=7.
compute v(cnt)=vec(#i).
end if.
end loop.
end repeat.
execute.

From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Arora, Manoj (IMDLR)
Sent: Wednesday, July 22, 2015 2:03 PM
To: [hidden email]
Subject: Finding the value from different set of variables

Hi,

I have 43 set of variables like v1_1_1 to v1_1_10, v1_2_1 to v1_2_10, v1_3_1 to v1_3_10 and so on  v1_43_1 to v1_43_10 and all these variable contains value from 1 to 10. I want to generate 43 new variables for value 5 & value 7.

I want to generate variables nv5_1 to nv5_43 will contain the value 5 and nv7_1 to nv7_43 with value 7.  I tried to solve this using vector command but could not solve it.

Thanks
Manoj





Kantar Disclaimer<http://www.kantar.com/disclaimer.html>
===================== To manage your subscription to SPSSX-L, send a message to [hidden email]<mailto:[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
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?"
Reply | Threaded
Open this post in threaded view
|

Re: Finding the value from different set of variables

Bruce Weaver
Administrator
I agree with David that a simplified example showing current state of the data file and desired state would be very helpful.  Meanwhile, I noticed that your two DO-REPEAT structures below are identical except for one line.  The first DO-REPEAT has:

do if vec(#i)=5.

And the second has:

do if vec(#i)=7.

So why not just have one DO-Repeat with this line in place of those two?

do if ANY(vec(#i),5,7).

Despite that observation, I suspect there is a more concise way to achieve what you're trying to do.  But no one is likely to work it out without the before and after examples David requested.

HTH.


David Marso wrote
So perhaps take another crack at describing the purpose/intention of this code?
What do you want to achieve from this.
Perhaps a simple whittled down example of inputs and desired output would be
useful to illustrate the mapping?
Just guessing that the face-palm didn't take?
---
Muthukkumaran(CHN/ANALYSIS) wrote
Hi,

Find below the syntax .

vector  v5_(43).
vector v=v5_1 to v5_43.
vector   vx1         =             v1_1_1 to           v1_1_10.
vector   vx2         =             v1_2_1 to           v1_2_10.
vector   vx3         =             v1_3_1 to           v1_3_10.
vector   vx4         =             v1_4_1 to           v1_4_10.
vector   vx5         =             v1_5_1 to           v1_5_10.
vector   vx6         =             v1_6_1 to           v1_6_10.
vector   vx7         =             v1_7_1 to           v1_7_10.
vector   vx8         =             v1_8_1 to           v1_8_10.
vector   vx9         =             v1_9_1 to           v1_9_10.
vector   vx10       =             v1_10_1               to           v1_10_10.
vector   vx11       =             v1_11_1               to           v1_11_10.
vector   vx12       =             v1_12_1               to           v1_12_10.
vector   vx13       =             v1_13_1               to           v1_13_10.
vector   vx14       =             v1_14_1               to           v1_14_10.
vector   vx15       =             v1_15_1               to           v1_15_10.
vector   vx16       =             v1_16_1               to           v1_16_10.
vector   vx17       =             v1_17_1               to           v1_17_10.
vector   vx18       =             v1_18_1               to           v1_18_10.
vector   vx19       =             v1_19_1               to           v1_19_10.
vector   vx20       =             v1_20_1               to           v1_20_10.
vector   vx21       =             v1_21_1               to           v1_21_10.
vector   vx22       =             v1_22_1               to           v1_22_10.
vector   vx23       =             v1_23_1               to           v1_23_10.
vector   vx24       =             v1_24_1               to           v1_24_10.
vector   vx25       =             v1_25_1               to           v1_25_10.
vector   vx26       =             v1_26_1               to           v1_26_10.
vector   vx27       =             v1_27_1               to           v1_27_10.
vector   vx28       =             v1_28_1               to           v1_28_10.
vector   vx29       =             v1_29_1               to           v1_29_10.
vector   vx30       =             v1_30_1               to           v1_30_10.
vector   vx31       =             v1_31_1               to           v1_31_10.
vector   vx32       =             v1_32_1               to           v1_32_10.
vector   vx33       =             v1_33_1               to           v1_33_10.
vector   vx34       =             v1_34_1               to           v1_34_10.
vector   vx35       =             v1_35_1               to           v1_35_10.
vector   vx36       =             v1_36_1               to           v1_36_10.
vector   vx37       =             v1_37_1               to           v1_37_10.
vector   vx38       =             v1_38_1               to           v1_38_10.
vector   vx39       =             v1_39_1               to           v1_39_10.
vector   vx40       =             v1_40_1               to           v1_40_10.
vector   vx41       =             v1_41_1               to           v1_41_10.
vector   vx42       =             v1_42_1               to           v1_42_10.
vector   vx43       =             v1_43_1               to           v1_43_10.

do repeat vec = vx1 to vx43 / cnt =1 to 43.
loop #i=1 to 10.
do if vec(#i)=5.
compute v(cnt)=vec(#i).
end if.
end loop.
end repeat.
execute.

do repeat vec = vx1 to vx43 / cnt =1 to 43.
loop #i=1 to 10.
do if vec(#i)=7.
compute v(cnt)=vec(#i).
end if.
end loop.
end repeat.
execute.

From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Arora, Manoj (IMDLR)
Sent: Wednesday, July 22, 2015 2:03 PM
To: [hidden email]
Subject: Finding the value from different set of variables

Hi,

I have 43 set of variables like v1_1_1 to v1_1_10, v1_2_1 to v1_2_10, v1_3_1 to v1_3_10 and so on  v1_43_1 to v1_43_10 and all these variable contains value from 1 to 10. I want to generate 43 new variables for value 5 & value 7.

I want to generate variables nv5_1 to nv5_43 will contain the value 5 and nv7_1 to nv7_43 with value 7.  I tried to solve this using vector command but could not solve it.

Thanks
Manoj





Kantar Disclaimer<http://www.kantar.com/disclaimer.html>
===================== To manage your subscription to SPSSX-L, send a message to [hidden email]<mailto:[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
--
Bruce Weaver
bweaver@lakeheadu.ca
http://sites.google.com/a/lakeheadu.ca/bweaver/

"When all else fails, RTFM."

PLEASE NOTE THE FOLLOWING: 
1. My Hotmail account is not monitored regularly. To send me an e-mail, please use the address shown above.
2. The SPSSX Discussion forum on Nabble is no longer linked to the SPSSX-L listserv administered by UGA (https://listserv.uga.edu/).
Reply | Threaded
Open this post in threaded view
|

Re: Finding the value from different set of variables

Ruben Geert van den Berg
Assuming the original variables are in the order mentioned in the OP (otherwise SORT VARIABLES BY NAME may achieve that), I'd simply go for Python here:

*Create 5 test cases.

data list free/id.
begin data
0 0 0 0 0
end data.

*Create original variables.

begin program.
import spss
for scnd in range(1,44):
    for thrd in range(1,11):
        spss.Submit('compute v1_%d_%d = trunc(rv.uni(1,11)).'%(scnd,thrd))
end program.

*Create 43 new variables.

begin program.
for scnd in range(1,44):
    spss.Submit('count nv5_%d = v1_%d_1 to v1_%d_10 (5).'%(scnd,scnd,scnd))
    spss.Submit('count nv7_%d = v1_%d_1 to v1_%d_10 (7).'%(scnd,scnd,scnd))
end program.

Reply | Threaded
Open this post in threaded view
|

Re: Finding the value from different set of variables

David Marso
Administrator
Ruben:
Since OP never really described with even the slightest bit of clarity what the problem was to begin with your ESPSS must be really super charged.  
BTW:  What exactly does this do?  
Looks like a bunch of counts.  
Where do you get that from the original postings?
<RANT>
I really wish people posting python code would comment a bit so others can acquire a bit of insight into the inner workings.  Otherwise it remains a bunch of meaningless gibberish.
</RANT>
For example:  Please unpack the following line for me assuming I am a complete idiot regarding python.
spss.Submit('count nv5_%d = v1_%d_1 to v1_%d_10 (5).'%(scnd,scnd,scnd))

Ruben Geert van den Berg wrote
Assuming the original variables are in the order mentioned in the OP (otherwise SORT VARIABLES BY NAME may achieve that), I'd simply go for Python here:

*Create 5 test cases.

data list free/id.
begin data
0 0 0 0 0
end data.

*Create original variables.

begin program.
import spss
for scnd in range(1,44):
    for thrd in range(1,11):
        spss.Submit('compute v1_%d_%d = trunc(rv.uni(1,11)).'%(scnd,thrd))
end program.

*Create 43 new variables.

begin program.
for scnd in range(1,44):
    spss.Submit('count nv5_%d = v1_%d_1 to v1_%d_10 (5).'%(scnd,scnd,scnd))
    spss.Submit('count nv7_%d = v1_%d_1 to v1_%d_10 (7).'%(scnd,scnd,scnd))
end program.
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?"
Reply | Threaded
Open this post in threaded view
|

Re: Finding the value from different set of variables

Bruce Weaver
Administrator
Here's my guess.  I think that Ruben's Python program...

begin program.
for scnd in range(1,44):
    spss.Submit('count nv5_%d = v1_%d_1 to v1_%d_10 (5).'%(scnd,scnd,scnd))
    spss.Submit('count nv7_%d = v1_%d_1 to v1_%d_10 (7).'%(scnd,scnd,scnd))
end program.

...is doing the following:

Loop 1
COUNT nv5_1 = v1_1_1 to v1_1_10 (5).
COUNT nv7_1 = v1_1_1 to v1_1_10 (7).

Loop 2
COUNT nv5_2 = v1_2_1 to v1_2_10 (5).
COUNT nv7_2 = v1_2_1 to v1_2_10 (7).

etc...

Loop 44
COUNT nv5_44 = v1_44_1 to v1_44_10 (5).
COUNT nv7_44 = v1_44_1 to v1_44_10 (7).



David Marso wrote
Ruben:
Since OP never really described with even the slightest bit of clarity what the problem was to begin with your ESPSS must be really super charged.  
BTW:  What exactly does this do?  
Looks like a bunch of counts.  
Where do you get that from the original postings?
<RANT>
I really wish people posting python code would comment a bit so others can acquire a bit of insight into the inner workings.  Otherwise it remains a bunch of meaningless gibberish.
</RANT>
For example:  Please unpack the following line for me assuming I am a complete idiot regarding python.
spss.Submit('count nv5_%d = v1_%d_1 to v1_%d_10 (5).'%(scnd,scnd,scnd))

Ruben Geert van den Berg wrote
Assuming the original variables are in the order mentioned in the OP (otherwise SORT VARIABLES BY NAME may achieve that), I'd simply go for Python here:

*Create 5 test cases.

data list free/id.
begin data
0 0 0 0 0
end data.

*Create original variables.

begin program.
import spss
for scnd in range(1,44):
    for thrd in range(1,11):
        spss.Submit('compute v1_%d_%d = trunc(rv.uni(1,11)).'%(scnd,thrd))
end program.

*Create 43 new variables.

begin program.
for scnd in range(1,44):
    spss.Submit('count nv5_%d = v1_%d_1 to v1_%d_10 (5).'%(scnd,scnd,scnd))
    spss.Submit('count nv7_%d = v1_%d_1 to v1_%d_10 (7).'%(scnd,scnd,scnd))
end program.
--
Bruce Weaver
bweaver@lakeheadu.ca
http://sites.google.com/a/lakeheadu.ca/bweaver/

"When all else fails, RTFM."

PLEASE NOTE THE FOLLOWING: 
1. My Hotmail account is not monitored regularly. To send me an e-mail, please use the address shown above.
2. The SPSSX Discussion forum on Nabble is no longer linked to the SPSSX-L listserv administered by UGA (https://listserv.uga.edu/).
Reply | Threaded
Open this post in threaded view
|

Re: Finding the value from different set of variables

David Marso
Administrator
Yeah, that's pretty obvious.  I was merely poking the dragon.
OTOH:  I really don't deduce any sort of COUNT from the OP monstrosity.
--

Bruce Weaver wrote
Here's my guess.  I think that Ruben's Python program...

begin program.
for scnd in range(1,44):
    spss.Submit('count nv5_%d = v1_%d_1 to v1_%d_10 (5).'%(scnd,scnd,scnd))
    spss.Submit('count nv7_%d = v1_%d_1 to v1_%d_10 (7).'%(scnd,scnd,scnd))
end program.

...is doing the following:

Loop 1
COUNT nv5_1 = v1_1_1 to v1_1_10 (5).
COUNT nv7_1 = v1_1_1 to v1_1_10 (7).

Loop 2
COUNT nv5_2 = v1_2_1 to v1_2_10 (5).
COUNT nv7_2 = v1_2_1 to v1_2_10 (7).

etc...

Loop 44
COUNT nv5_44 = v1_44_1 to v1_44_10 (5).
COUNT nv7_44 = v1_44_1 to v1_44_10 (7).



David Marso wrote
Ruben:
Since OP never really described with even the slightest bit of clarity what the problem was to begin with your ESPSS must be really super charged.  
BTW:  What exactly does this do?  
Looks like a bunch of counts.  
Where do you get that from the original postings?
<RANT>
I really wish people posting python code would comment a bit so others can acquire a bit of insight into the inner workings.  Otherwise it remains a bunch of meaningless gibberish.
</RANT>
For example:  Please unpack the following line for me assuming I am a complete idiot regarding python.
spss.Submit('count nv5_%d = v1_%d_1 to v1_%d_10 (5).'%(scnd,scnd,scnd))

Ruben Geert van den Berg wrote
Assuming the original variables are in the order mentioned in the OP (otherwise SORT VARIABLES BY NAME may achieve that), I'd simply go for Python here:

*Create 5 test cases.

data list free/id.
begin data
0 0 0 0 0
end data.

*Create original variables.

begin program.
import spss
for scnd in range(1,44):
    for thrd in range(1,11):
        spss.Submit('compute v1_%d_%d = trunc(rv.uni(1,11)).'%(scnd,thrd))
end program.

*Create 43 new variables.

begin program.
for scnd in range(1,44):
    spss.Submit('count nv5_%d = v1_%d_1 to v1_%d_10 (5).'%(scnd,scnd,scnd))
    spss.Submit('count nv7_%d = v1_%d_1 to v1_%d_10 (7).'%(scnd,scnd,scnd))
end program.
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?"