top 5

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

top 5

Leo Bakker
hello all,

Is it possible with ctables to get a table with only the top5 percentages
of that variable?

thanks fot helping,
Leo

=====================
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: top 5

Jon K Peck
CTABLES doesn't have a top box capability built in, but there is a programmability function that can give you this.  Here is an example.  The program finds the top 5 categories of the variable educ and creates a macro that can be referenced in the CTABLES CATEGORIES subcommand.  The genCategoryList function has some other features that might be useful, but this shows the basics.

begin program.
import spss, spssaux2
catlist = spssaux2.genCategoryList("educ")[0]
catlist = " ".join([str(item[1]) for item in catlist[:5]])
spss.SetMacroValue("!top5", catlist)
end program.

ctables /table educ by jobcat /categories variables= educ [!top5].

This requires the Python programmability plugin and the spssaux2.py module that can be downloaded from SPSS Developer Central, www.spss.com/devcentral

HTH,

Jon Peck
Senior Software Engineer, IBM
[hidden email]
312-651-3435




From:        Leo Bakker <[hidden email]>
To:        [hidden email]
Date:        11/17/2010 08:22 AM
Subject:        [SPSSX-L] top 5
Sent by:        "SPSSX(r) Discussion" <[hidden email]>




hello all,

Is it possible with ctables to get a table with only the top5 percentages
of that variable?

thanks fot helping,
Leo

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