problem with Aggregate function - thank you

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

problem with Aggregate function - thank you

thara vardhan-2

Dear List Members

First of all I would like to convey my heartfelt thanks to all those who responded with suggestions/solution & syntax
to my problem with the aggregate command.

My apologies if i have not explained more clearly about my data file.  

Ariel Barak solution of using identifying duplicates, match sequence and select command does exactly what I need  i.e
to create a output data file that has a unique legalaction record for every eventrefnum and incidentnum based on the earliest legal action date.

Here is how i did it using the menu :

Ariel Barak Solution

First sort cases by Erefnum and Inc ref num
Click on

* Identify Duplicate Cases.

Define matching cases by Erefnum
                                    Increfnum

Sort within matching groups by legactdate

Click on primary first

Click on sequential count of matching groups in each case

This will create 2 variables primary first and match sequence

Select if matchsequence =0.

This will give all unique records where there is only one legalactdate for every eventref number/incidentrefnum.

Save it as file 1.

Select if match sequence not eq 0.

This will give eventref and incref records with multiple legal act dates.

Save this as file2.

In file 2 select if primary first =1.
Execute.

This will give records where the legalactdate is the first.
Save this as file 3.

Than use match file add cases function to merge file1 and file3. This will give a unique file for all legal actions.

While aggregate command helps me identify the earliest legal action date through the mode=add variables function - it does not help me select unique records to create a new datafile.

Thank you once again.

regards
thara

 






_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

The information contained in this email is intended for the named recipient(s) 
only. It may contain private, confidential, copyright or legally privileged 
information.  If you are not the intended recipient or you have received this 
email by mistake, please reply to the author and delete this email immediately. 
You must not copy, print, forward or distribute this email, nor place reliance 
on its contents. This email and any attachment have been virus scanned. However, 
you are requested to conduct a virus scan as well.  No liability is accepted 
for any loss or damage resulting from a computer virus, or resulting from a delay
or defect in transmission of this email or any attached file. This email does not 
constitute a representation by the NSW Police Force unless the author is legally 
entitled to do so.


Reply | Threaded
Open this post in threaded view
|

Re: problem with Aggregate function - thank you

David Marso
Administrator
SORT CASES by primary_keys lower_key.
MATCH FILES / FILE * / BY primary_keys /FIRST=keep.
DO IF keep.
XSAVE OUTFILE 'unique earliest'.
END IF.
EXE.
---

Thara Vardhan wrote
Dear List Members

First of all I would like to convey my heartfelt thanks to all those who
responded with suggestions/solution & syntax
to my problem with the aggregate command.

My apologies if i have not explained more clearly about my data file.

Ariel Barak solution of using identifying duplicates, match sequence and
select command does exactly what I need  i.e
to create a output data file that has a unique legalaction record for
every eventrefnum and incidentnum based on the earliest legal action date.

Here is how i did it using the menu :

Ariel Barak Solution

First sort cases by Erefnum and Inc ref num
Click on

* Identify Duplicate Cases.

Define matching cases by Erefnum
                                    Increfnum

Sort within matching groups by legactdate

Click on primary first

Click on sequential count of matching groups in each case

This will create 2 variables primary first and match sequence

Select if matchsequence =0.

This will give all unique records where there is only one legalactdate for
every eventref number/incidentrefnum.

Save it as file 1.

Select if match sequence not eq 0.

This will give eventref and incref records with multiple legal act dates.

Save this as file2.

In file 2 select if primary first =1.
Execute.

This will give records where the legalactdate is the first.
Save this as file 3.

Than use match file add cases function to merge file1 and file3. This will
give a unique file for all legal actions.

While aggregate command helps me identify the earliest legal action date
through the mode=add variables function - it does not help me select
unique records to create a new datafile.

Thank you once again.

regards
thara





_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

The information contained in this email is intended for the named recipient(s)
only. It may contain private, confidential, copyright or legally privileged
information.  If you are not the intended recipient or you have received this
email by mistake, please reply to the author and delete this email immediately.
You must not copy, print, forward or distribute this email, nor place reliance
on its contents. This email and any attachment have been virus scanned. However,
you are requested to conduct a virus scan as well.  No liability is accepted
for any loss or damage resulting from a computer virus, or resulting from a delay
or defect in transmission of this email or any attached file. This email does not
constitute a representation by the NSW Police Force unless the author is legally
entitled to do so.
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?"