Ascending-descending frequencies in mult response

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

Ascending-descending frequencies in mult response

John F Hall

There doesn’t appear to be a facility in MULT RESP to arrange rows or columns in ascending/descending order of frequencies.  Be nice if we could.

 

John F Hall (Mr)

[Retired academic survey researcher]

 

Email:   [hidden email] 

Website: www.surveyresearch.weebly.com

SPSS start page:  www.surveyresearch.weebly.com/1-survey-analysis-workshop

 

 

 

===================== 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: Ascending-descending frequencies in mult response

Jignesh Sutar
Download the Extension STATS CATEGORY ORDER.

Which is designed to achieve this, and more, such as anchoring "Other" &/or "Don't know" to the bottom.

Reply | Threaded
Open this post in threaded view
|

Re: Ascending-descending frequencies in mult response

Jignesh Sutar
John, You can do this directly in CTABLES, see CATEGORIES VARIABLES sub command. I've also shown how you can use STATS CATEGORY ORDER to anchor Other/Don't know, if required.


dataset close all.
new file.
output close all.

set seed = 10. 
input program. 
loop #i = 1 to 500. 
  compute case = #i. 
  
  vector v(20).
  loop #j=1 to 20.
      compute v(#j)=rnd(rv.uniform(0,1)).
  end loop.
end case. 
end loop. 
end file. 
end input program. 
dataset name sim. 
execute. 

descrip v1 to v20 /stat sum.

mrsets /mdgroup name=$mrsset_origOrderVars categorylabels=varlabels variables = v1 to v20 value=1 /display name=[$mrsset_origOrderVars].

ctables /table $mrsset_origOrderVars /titles title="Table1: Unodered".
ctables /table $mrsset_origOrderVars /titles title="Table2: Ordered" /categories variables=$mrsset_origOrderVars order=d key=count.


stats category order items=$mrsset_origOrderVars prefix=dorder specialvars=v19 v20 other=no
/options order=d categorylabels=varlabels specialsloc=after missing=exclude.

ctables /table $dorder_$mrsset_origOrderVars /titles title="Table3: Ordered (via STATS CATEGORY ORDER with Other/DK anchored)".

Reply | Threaded
Open this post in threaded view
|

Re: Ascending-descending frequencies in mult response

Jignesh Sutar
PS. If you wrap syntax code with "Raw text" tag then it fails to come through in email

So here's the code for those not reading via nabble (but email):

dataset close all.
new file.
output close all.

set seed = 10.
input program.
loop #i = 1 to 500.
  compute case = #i.
 
  vector v(20).
  loop #j=1 to 20.
      compute v(#j)=rnd(rv.uniform(0,1)).
  end loop.
end case.
end loop.
end file.
end input program.
dataset name sim.
execute.

descrip v1 to v20 /stat sum.

mrsets /mdgroup name=$mrsset_origOrderVars categorylabels=varlabels variables = v1 to v20 value=1 /display name=[$mrsset_origOrderVars].

ctables /table $mrsset_origOrderVars /titles title="Table1: Unodered".
ctables /table $mrsset_origOrderVars /titles title="Table2: Ordered" /categories variables=$mrsset_origOrderVars order=d key=count.


stats category order items=$mrsset_origOrderVars prefix=dorder specialvars=v19 v20 other=no
/options order=d categorylabels=varlabels specialsloc=after missing=exclude.

ctables /table $dorder_$mrsset_origOrderVars /titles title="Table3: Ordered (via STATS CATEGORY ORDER with Other/DK anchored)".
Reply | Threaded
Open this post in threaded view
|

Re: Ascending-descending frequencies in mult response

Jon K Peck
In reply to this post by John F Hall
You can control the sort order of MR (or regular) variables in CTABLES.  The output can be order by category value, category label, or category count.  In syntax it would look like this

/CATEGORIES VARIABLES=$myMRvariable ORDER=D KEY=COUNT

Jon Peck (no "h") aka Kim
Senior Software Engineer, IBM
[hidden email]
phone: 720-342-5621




From:        John F Hall <[hidden email]>
To:        [hidden email]
Date:        06/01/2015 02:58 AM
Subject:        [SPSSX-L] Ascending-descending frequencies in mult response
Sent by:        "SPSSX(r) Discussion" <[hidden email]>




There doesn’t appear to be a facility in MULT RESP to arrange rows or columns in ascending/descending order of frequencies.  Be nice if we could.

 

John F Hall (Mr)

[Retired academic survey researcher]

 

Email:   johnfhall@...  

Website: www.surveyresearch.weebly.com

SPSS start page:  www.surveyresearch.weebly.com/1-survey-analysis-workshop

 

 

 

===================== To manage your subscription to SPSSX-L, send a message to LISTSERV@... (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: Ascending-descending frequencies in mult response

John F Hall

 

Jon

 

Many thanks for this.

 

My version was:

 

mult resp groups=

Q2 'Quals working for..' (v109 to v112 (1,7))

                       /freq q2.

 

 

Q2 Frequencies

 

Responses

Percent of Cases

N

Percent

Quals working for..a

GCSE

186

19.2%

23.1%

BTEC

32

3.3%

4.0%

A-levels

677

69.7%

84.2%

CPVE

6

0.6%

0.7%

City and Guilds

18

1.9%

2.2%

RSA

23

2.4%

2.9%

Other

29

3.0%

3.6%

Total

971

100.0%

120.8%

a. Group

 

It took me an hour to work out what to do and then write  something in CTABLES, (only one error, used # instead of $ for setname: print in TFM too small) but I eventually got to:

 

MRSETS

/McGROUP      NAME= $Q2 LABEL=  'Quals working for..'

VARIABLES= v109 to v112

/DISPLAY         NAME= [$Q2].

 

ctables

/tab $q2

/CATEGORIES VARIABLES=$q2 ORDER=D KEY=COUNT.

 

 

 

Count

Quals working for..

A-levels

677

GCSE

185

BTEC

32

Other

29

RSA

23

City and Guilds

18

CPVE

6

 

Will play with CTABLES to get % and TOTAL displayed, then see if I can decipher Jignesh’s fearsome code.

 

Nice to see /FORMAT CONDENSE still available in MULT RESPONSE: can’t see when I’d use it, but why was it ever removed from FREQUENCIES?

 

John

 

 

 

 

From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Jon K Peck
Sent: 01 June 2015 14:21
To: [hidden email]
Subject: Re: Ascending-descending frequencies in mult response

 

You can control the sort order of MR (or regular) variables in CTABLES.  The output can be order by category value, category label, or category count.  In syntax it would look like this

/CATEGORIES VARIABLES=$myMRvariable ORDER=D KEY=COUNT

Jon Peck (no "h") aka Kim
Senior Software Engineer, IBM
[hidden email]
phone: 720-342-5621




From:        John F Hall <[hidden email]>
To:        [hidden email]
Date:        06/01/2015 02:58 AM
Subject:        [SPSSX-L] Ascending-descending frequencies in mult response
Sent by:        "SPSSX(r) Discussion" <[hidden email]>





There doesn’t appear to be a facility in MULT RESP to arrange rows or columns in ascending/descending order of frequencies.  Be nice if we could.

 

John F Hall (Mr)

[Retired academic survey researcher]

 

Email:   [hidden email]  

Website: www.surveyresearch.weebly.com

SPSS start page:  www.surveyresearch.weebly.com/1-survey-analysis-workshop

 

 

 

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

===================== 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: Ascending-descending frequencies in mult response

John F Hall
In reply to this post by Jignesh Sutar

Jignesh

 

My variables are MCGROUP, not MDGROUP.  I've modified your syntax, but it effectively comes out the same as Jon's. 

 

mrsets

    /mcgroup name=$q17 label = 'Newspapers read' variables = v207 to v213

    /display name=[$q17].

ctables /table $q17 /titles title="Table1: Unordered".

ctables /table $q17 /titles title="Table2: Ordered"

            /categories variables=$q17 order=d key=count.

 

 

Table2: Ordered

 

Count

Newspapers read

Local   evening

206

Mail

135

Mirror

124

Tele-   graph

105

Express

101

Sun

90

Independ-ent

76

Guardian

76

Times

69

Local   morning

51

Today

37

Financ. Times

30

Star

19

Too many

5

Morning Star

1

 

 

Table2: Ordered

 

Count

Newspapers read

Local   evening

206

Mail

135

Mirror

124

Tele-   graph

105

Express

101

Sun

90

Independ-ent

76

Guardian

76

Times

69

Local   morning

51

Today

37

Financ. Times

30

Star

19

Too many

5

Morning Star

1

 

Even after RTFM I can't get any %% displayed, just error messages.  For some reason COLPCT.COUNT and others cause errors.

 

John

 

 

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Jignesh Sutar
Sent: 01 June 2015 12:55
To: [hidden email]
Subject: Re: Ascending-descending frequencies in mult response

 

PS. If you wrap syntax code with "Raw text" tag then it fails to come through in email

 

So here's the code for those not reading via nabble (but email):

 

dataset close all.

new file.

output close all.

 

set seed = 10.

input program.

loop #i = 1 to 500.

  compute case = #i.

  

  vector v(20).

  loop #j=1 to 20.

      compute v(#j)=rnd(rv.uniform(0,1)).

  end loop.

end case.

end loop.

end file.

end input program.

dataset name sim.

execute.

 

descrip v1 to v20 /stat sum.

 

mrsets /mdgroup name=$mrsset_origOrderVars categorylabels=varlabels variables = v1 to v20 value=1 /display name=[$mrsset_origOrderVars].

 

ctables /table $mrsset_origOrderVars /titles title="Table1: Unodered".

ctables /table $mrsset_origOrderVars /titles title="Table2: Ordered"

/categories variables=$mrsset_origOrderVars order=d key=count.

 

 

stats category order items=$mrsset_origOrderVars prefix=dorder

specialvars=v19 v20 other=no

/options order=d categorylabels=varlabels specialsloc=after missing=exclude.

 

ctables /table $dorder_$mrsset_origOrderVars /titles title="Table3: Ordered (via STATS CATEGORY ORDER with Other/DK anchored)".

 

 

 

--

View this message in context: http://spssx-discussion.1045642.n5.nabble.com/Ascending-descending-frequencies-in-mult-response-tp5729660p5729667.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

===================== 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: Ascending-descending frequencies in mult response

John F Hall
In reply to this post by John F Hall

Jignesh

 

Well spotted!  I really don’t have time to study all this syntax: it took me the whole morning to get that far!.  Undergrad students would have gone home hours ago.  Why can’t they just have /FOR DVAL in MULT RESP?

 

It’s not for me but I was checking the data from a 1989 survey in FE colleges and Sixth Forms of Attitudes to Proposed Student Loans (conducted by the National Union of Students) which Edinburgh have agreed to curate, so I can clear it from my machine. 

(See: http://stats.datalib.edina.ac.uk/sdaweb/analysis/?dataset=nus89)

 

Essex Re-share is too bureaucratic (I don’t have authorisation for the data and no-one answers repeated requests, but I’m loath to destroy them).  At least Essex can store and distribute the SPSS *.sav file: with Edinburgh you have to re-create it (in Stata and SAS as well as SPSS) but why anyone would want to use Stata or SAS on small surveys is beyond my comprehension.

 

John

 

From: [hidden email] [mailto:[hidden email]] On Behalf Of Jignesh Sutar
Sent: 02 June 2015 13:09
To: John F Hall
Subject: Re: Ascending-descending frequencies in mult response

 

You don't want "Other" floating around there in the middle! Have no fear, start studying! Happy to help out if you get stuck...

 

On 2 June 2015 at 11:00, John F Hall <[hidden email]> wrote:

 

Jon

 

Many thanks for this.

 

My version was:

 

mult resp groups=

Q2 'Quals working for..' (v109 to v112 (1,7))

                       /freq q2.

 

 

Q2 Frequencies

 

Responses

Percent of Cases

N

Percent

Quals working for..a

GCSE

186

19.2%

23.1%

BTEC

32

3.3%

4.0%

A-levels

677

69.7%

84.2%

CPVE

6

0.6%

0.7%

City and Guilds

18

1.9%

2.2%

RSA

23

2.4%

2.9%

Other

29

3.0%

3.6%

Total

971

100.0%

120.8%

a. Group

 

It took me an hour to work out what to do and then write  something in CTABLES, (only one error, used # instead of $ for setname: print in TFM too small) but I eventually got to:

 

MRSETS

/McGROUP      NAME= $Q2 LABEL=  'Quals working for..'

VARIABLES= v109 to v112

/DISPLAY         NAME= [$Q2].

 

ctables

/tab $q2

/CATEGORIES VARIABLES=$q2 ORDER=D KEY=COUNT.

 

 

 

Count

Quals working for..

A-levels

677

GCSE

185

BTEC

32

Other

29

RSA

23

City and Guilds

18

CPVE

6

 

Will play with CTABLES to get % and TOTAL displayed, then see if I can decipher Jignesh’s fearsome code.

 

Nice to see /FORMAT CONDENSE still available in MULT RESPONSE: can’t see when I’d use it, but why was it ever removed from FREQUENCIES?

 

John

 

 

 

 

From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Jon K Peck
Sent: 01 June 2015 14:21
To: [hidden email]
Subject: Re: Ascending-descending frequencies in mult response

 

You can control the sort order of MR (or regular) variables in CTABLES.  The output can be order by category value, category label, or category count.  In syntax it would look like this

/CATEGORIES VARIABLES=$myMRvariable ORDER=D KEY=COUNT

Jon Peck (no "h") aka Kim
Senior Software Engineer, IBM
[hidden email]
phone: 720-342-5621




From:        John F Hall <[hidden email]>
To:        [hidden email]
Date:        06/01/2015 02:58 AM
Subject:        [SPSSX-L] Ascending-descending frequencies in mult response
Sent by:        "SPSSX(r) Discussion" <[hidden email]>





There doesn’t appear to be a facility in MULT RESP to arrange rows or columns in ascending/descending order of frequencies.  Be nice if we could.

 

John F Hall (Mr)

[Retired academic survey researcher]

 

Email:   [hidden email]  

Website: www.surveyresearch.weebly.com

SPSS start page:  www.surveyresearch.weebly.com/1-survey-analysis-workshop

 

 

 

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

 

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