Data "Count Unique" instead of count all

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

Data "Count Unique" instead of count all

acolmanj
Hi,

I want to build an output where the values are calculated from the count of _unique_ values instead of the normal count all cases.

My raw data would be in the form:

V1_____V2__
fff       240  
rrr        222  
rrr        222  
ttt      240
sss      240
sss      240
zzz      240

And I´d want the count to show..

240 - 4
222 - 1

Seems simple, but I can´t do it !!!

Any help appreciated.

John.
Reply | Threaded
Open this post in threaded view
|

Re: Data "Count Unique" instead of count all

David Marso
Administrator
This post was updated on .
data list / v1 v2 (a3,x,f3).
begin data
fff 240  
rrr 222  
rrr 222  
ttt 240
sss 240
sss 240
zzz 240
end data.
AGGREGATE OUTFILE * / BREAK v2 v1 / n=n.
FREQ V2.
        V2

  Frequency Percent Valid Percent Cumulative Percent
Valid 222 1        20.0 20.0 20.0
  240 4        80.0 80.0 100.0
  Total 5 100.0 100.0
acolmanj wrote
Hi,

I want to build an output where the values are calculated from the count of _unique_ values instead of the normal count all cases.

My raw data would be in the form:

V1_____V2__
fff       240  
rrr        222  
rrr        222  
ttt      240
sss      240
sss      240
zzz      240

And I´d want the count to show..

240 - 4
222 - 1

Seems simple, but I can´t do it !!!

Any help appreciated.

John.
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
|

Automatic reply: Data "Count Unique" instead of count all

Lemon, John S.
In reply to this post by acolmanj

I'm not in the office until 08:00 Wednesday 22nd August 2012 - I will try and respond on my return.





The University of Aberdeen is a charity registered in Scotland, No SC013683.
Reply | Threaded
Open this post in threaded view
|

Re: Data "Count Unique" instead of count all

Rich Ulrich
In reply to this post by acolmanj
Do an Aggregate, breaking on V1 and V2, and ask
for nothing but the count (which you can ignore).  That
gives you one line for each combination of V1 and V2.

The do a Frequency on V2.

--
Rich Ulrich

> Date: Fri, 17 Aug 2012 06:54:15 -0700

> From: [hidden email]
> Subject: Data "Count Unique" instead of count all
> To: [hidden email]
>
> Hi,
>
> I want to build an output where the values are calculated from the count of
> _unique_ values instead of the normal count all cases.
>
> My raw data would be in the form:
>
> V1_____V2__
> fff 240
> rrr 222
> rrr 222
> ttt 240
> sss 240
> sss 240
> zzz 240
>
> And I´d want the count to show..
>
> 240 - 4
> 222 - 1
>
> Seems simple, but I can´t do it !!!
>
> Any help appreciated.
>
> John.
>
>
>
> --
> View this message in context: http://spssx-discussion.1045642.n5.nabble.com/Data-Count-Unique-instead-of-count-all-tp5714755.html
> Sent from the SPSSX Discussion mailing list archive at Nabble.com.
>
> =====================
> 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