How to customize the value labels order

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

How to customize the value labels order

jagadishpchary
HI,

I have a variable with value labels as brand names and also have other statements like " Don't know", "No answer" & "Other". So would like to know is there any syntax where I can get all the other statements at the end putting all the brand names in the first. I have attached a 'Test.sav' data - when running the 'Ctables' or 'FREQUENCIES' I am getting the below table i.e. 'BEFORE' and  'AFTER' should be my final table. 
Reply | Threaded
Open this post in threaded view
|

Re: How to customize the value labels order

John F Hall

Your AFTER tables are illogical: why is Brand1 displayed below Brand2 and Brand4?  How many cases do you actually have?  If you have only 7 cases, you're wasting your time anyway (and ours).

 

You need to make sure your values (and value labels) are:

 

1 = Brand1

2 = Brand2

3 = Brand3

4 = Brand4

5 = Other

 

. .then make sure that values for DK and NA are higher than these, eg

 

8 = DK

9 = NA

 

. . and are declared as missing.  They will then be displayed after the valid values.

 

VALUE LABELS

    var1 1 ‘Brand1’

2 ‘Brand2’

3 ‘Brand3’

4 ‘Brand4’

5 ‘Other’.

MISSING VALUES  

var1 (8,9).

FREQ var1.

 

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

 

 

 

 

-----Original Message-----
From: SPSSX’r) Discussion [mailto:[hidden email]] On Behalf Of jagadishpchary
Sent: 31 July 2015 08:55
To: [hidden email]
Subject: How to customize the value labels order

 

HI,

 

I have a variable with value labels as brand names and also have other statements like " Don't know", "No answer" & "Other". So would like to know is there any syntax where I can get all the other statements at the end putting all the brand names in the first. I have attached a 'Test.sav' data

- when running the 'Ctables' or 'FREQUENCIES' I am getting the below table i.e. 'BEFORE' and  'AFTER' should be my final table.

<http://spssx-discussion.1045642.n5.nabble.com/file/n5730335/Untitled.png> 

 

 

 

--

View this message in context: http://spssx-discussion.1045642.n5.nabble.com/How-to-customize-the-value-labels-order-tp5730335.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: How to customize the value labels order

David Marso
Administrator
In reply to this post by jagadishpchary
NOTE:  I don't have a license for CTABLES!
You as a user of this command within a professional capacity should avail yourself of the valuable info in the FM!!!
===
CATEGORIES Subcommand (CTABLES command)


The CATEGORIES subcommand controls the order of categories in the rows and columns of the table, controls the showing and hiding of ordinary and user-missing values, and controls the computation of totals and subtotals.
/CATEGORIES  VARIABLES= varlist  

    { [value, value, value...]                              }
    { ORDER= {A} KEY= {VALUE           } MISSING= {EXCLUDE} }
             {D}      {LABEL           }          {INCLUDE}
                      {summary(varname)}

     TOTAL= {NO  }  LABEL= "label" POSITION= {AFTER } EMPTY= {INCLUDE}
            {YES }                           {BEFORE}        {EXCLUDE}

The minimum specification is a variable list and one of the following specifications: a category specification, TOTAL specification, or EMPTY specification. The variable list can be a list of variables or the keyword ALL, which refers to all category variables in the table expression. ALL cannot be used with the explicit category list.

jagadishpchary wrote
HI,

I have a variable with value labels as brand names and also have other statements like " Don't know", "No answer" & "Other". So would like to know is there any syntax where I can get all the other statements at the end putting all the brand names in the first. I have attached a 'Test.sav' data - when running the 'Ctables' or 'FREQUENCIES' I am getting the below table i.e. 'BEFORE' and  'AFTER' should be my final table.
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: How to customize the value labels order

jagadishpchary
In reply to this post by John F Hall
Hi John:

I Hope this forum is meant to get most optimum solution but not to waste anyone's time. I am already aware that the highest value will be displayed at the end. However, as a example I have provided a dataset with 7 cases. In my main data set for a brand variable there are more than 500 brands (value labels) and that too I am processing my files using R-software and exporting to SPSS environment. Ours is continuous process so we merge the data sets of historic using 'R'. Hence, when we export to SPSS the value labels are considered in alphabetical order and codes are assigned in a sequential manner (the original given values in SPSS are disturbed). So as per my question the statements like " Don't know", "No answer" & "Other" etc are displayed in the middle. Now I cannot re-code all these stubs to higher values (because I have many brand vars in my data set). So let me know if there is any easier way where I control these mentioned statements to be placed at the end.

Thanks
Reply | Threaded
Open this post in threaded view
|

Re: How to customize the value labels order

Jon K Peck
As others have posted, the CTABLES CATEGORIES subcommand allows you to specify the order of the categories explicitly or via a sort specification.  However, it can happen that sorting by labels, counts etc puts special categories like other and na in an inconvenient place in the table.  The STATS CATEGORY ORDER extension command allows you to get around this and do things like placing these special categories at the beginning or the end.  Once it is installed (it is included in the Python Essentials as of V23 and installable from Utilities in 22 and later and obtainable from the SPSS Community website for earlier versions), you will find it on Analyze > Custom Tables > Define Category Order.  It has standard Statistics syntax with help available via F1 in the SE in V23 and by running STATS CATEGORY ORDER /HELP in earlier versions.

STATS CATEGORY ORDER works by creating macros listing category values that can then be used in the CTABLES CATEGORIES. subcommand.

HTH,


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




From:        jagadishpchary <[hidden email]>
To:        [hidden email]
Date:        07/31/2015 03:34 AM
Subject:        Re: [SPSSX-L] How to customize the value labels order
Sent by:        "SPSSX(r) Discussion" <[hidden email]>




Hi John:

I Hope this forum is meant to get most optimum solution but not to waste
anyone's time. I am already aware that the highest value will be displayed
at the end. However, as a example I have provided a dataset with 7 cases. In
my main data set for a brand variable there are more than 500 brands (value
labels) and that too I am processing my files using R-software and exporting
to SPSS environment. Ours is continuous process so we merge the data sets of
historic using 'R'. Hence, when we export to SPSS the value labels are
considered in alphabetical order and codes are assigned in a sequential
manner (the original given values in SPSS are disturbed). So as per my
question the statements like " Don't know", "No answer" & "Other" etc are
displayed in the middle. Now I cannot re-code all these stubs to higher
values (because I have many brand vars in my data set). So let me know if
there is any easier way where I control these mentioned statements to be
placed at the end.

Thanks



--
View this message in context:
http://spssx-discussion.1045642.n5.nabble.com/How-to-customize-the-value-labels-order-tp5730335p5730338.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