Aggregate Based on Digits

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

Aggregate Based on Digits

Rajeshms
Dear all,

I need to get aggregate values for some indexes. The question is as follows..........

NIC_Code  Index1 Index2 index3...............

12311         23..........................................
12312          .
12313           .
12321           .
12321           . 
12322           45...........................................
12321           .
12324           .
12329            ..
12411              .
12413              78...............................................
12416            .
12510             .
12511            ..
12512             .89...................................................

In the above I have NIC5 digit Code and few indexes.  I need to calculate index for Index 1 to Index 3.


But I need to get index for 5digit level that is when my NIC code is 5digit level.

And my NIV code is at 4 digit level..., ie I need to get aggregate of NIC code keeping same for 4 digits and get the aggregation for last digit.

Similarly for 3 digit and 2 digit.....so how to do this using spss ...is there any function to get this. Kindly help me sir......thanks all Bye.

--
Regards,

Rajesh M S




Reply | Threaded
Open this post in threaded view
|

Re: Aggregate Based on Digits

David Marso
Administrator
You need to provide a specific example of what you are talking about.
With input and desired output.  
Preferably with a mocked up data list so we don't have to retype data!
Rajeshms wrote
Dear all,

I need to get aggregate values for some indexes. The question is as
follows..........

NIC_Code  Index1 Index2 index3...............

12311         23..........................................
12312          .
12313           .
12321           .
12321           .
12322           45...........................................
12321           .
12324           .
12329            ..
12411              .
12413              78...............................................
12416            .
12510             .
12511            ..
12512             .89...................................................

In the above I have NIC5 digit Code and few indexes.  I need to calculate
index for Index 1 to Index 3.


But I need to get index for 5digit level that is when my NIC code is 5digit
level.

And my NIV code is at 4 digit level..., ie I need to get aggregate of NIC
code keeping same for 4 digits and get the aggregation for last digit.

Similarly for 3 digit and 2 digit.....so how to do this using spss ...is
there any function to get this. Kindly help me sir......thanks all Bye.

--
Regards,

Rajesh M S
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: Aggregate Based on Digits

Rich Ulrich
In reply to this post by Rajeshms
Googling tells me that NIC codes might be hierarchically defined.
What is an "Index"?  - I am going to assume that these are something
to be totalled.

What I understand is that you want to get subtotals for each level of
the hierarchy defined by NIC codes, except for the final digit.  One
simple way to do that is to create 4 new variables from the NIC code -

For instance, "12311"  gives new values of  1, 2, 3, 1 -- which might
stand for, geographically, as Nation, State, County, Precinct (with Ward
being the final digit).  But geographical divisions are not arbitrarily
defined by some organization, so they don't fit the actual problem.
The NIC is the a-prior list that gives subdivisions of products.  Or
something like that.

You can use Report Generator to create a report that optionally lists
all the detailed lines, and gives totals on all the "breaks" for each
division, using the new variables.  Assuming you want totals of indexes.

--
Rich Ulrich




Date: Thu, 14 Mar 2013 12:31:19 +0530
From: [hidden email]
Subject: Aggregate Based on Digits
To: [hidden email]

Dear all,

I need to get aggregate values for some indexes. The question is as follows..........

NIC_Code  Index1 Index2 index3...............

12311         23..........................................
12312          .
12313           .
12321           .
12321           . 
12322           45...........................................
12321           .
12324           .
12329            ..
12411              .
12413              78...............................................
12416            .
12510             .
12511            ..
12512             .89...................................................

In the above I have NIC5 digit Code and few indexes.  I need to calculate index for Index 1 to Index 3.


But I need to get index for 5digit level that is when my NIC code is 5digit level.

And my NIV code is at 4 digit level..., ie I need to get aggregate of NIC code keeping same for 4 digits and get the aggregation for last digit.

Similarly for 3 digit and 2 digit.....so how to do this using spss ...is there any function to get this. Kindly help me sir......thanks all Bye.

--
Regards,

Rajesh M S


Reply | Threaded
Open this post in threaded view
|

Re: Aggregate Based on Digits

David Marso
Administrator
Ah, then it is  simple matter of working through a sequence of  (#: 1..3).
TRUNC(NIC/10**#)           if NIC is Numeric  .
or CHAR.SUBSTR(NIC,1,#) if NIC is String.
Breaking on the result...
--
Rich Ulrich-2 wrote
Googling tells me that NIC codes might be hierarchically defined.
What is an "Index"?  - I am going to assume that these are something
to be totalled.

What I understand is that you want to get subtotals for each level of
the hierarchy defined by NIC codes, except for the final digit.  One
simple way to do that is to create 4 new variables from the NIC code -

For instance, "12311"  gives new values of  1, 2, 3, 1 -- which might
stand for, geographically, as Nation, State, County, Precinct (with Ward
being the final digit).  But geographical divisions are not arbitrarily
defined by some organization, so they don't fit the actual problem.
The NIC is the a-prior list that gives subdivisions of products.  Or
something like that.

You can use Report Generator to create a report that optionally lists
all the detailed lines, and gives totals on all the "breaks" for each
division, using the new variables.  Assuming you want totals of indexes.

--
Rich Ulrich



Date: Thu, 14 Mar 2013 12:31:19 +0530
From: [hidden email]
Subject: Aggregate Based on Digits
To: [hidden email]

Dear all,
I need to get aggregate values for some indexes. The question is as follows..........
NIC_Code  Index1 Index2 index3...............

12311         23..........................................12312          .12313           .12321           .12321           . 12322           45...........................................
12321           .12324           .12329            ..12411              .12413              78...............................................12416            .
12510             .12511            ..12512             .89...................................................
In the above I have NIC5 digit Code and few indexes.  I need to calculate index for Index 1 to Index 3.


But I need to get index for 5digit level that is when my NIC code is 5digit level.
And my NIV code is at 4 digit level..., ie I need to get aggregate of NIC code keeping same for 4 digits and get the aggregation for last digit.

Similarly for 3 digit and 2 digit.....so how to do this using spss ...is there any function to get this. Kindly help me sir......thanks all Bye.
--

Regards,
Rajesh M S
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?"