How to assemble a datset with with Likert or similar items as rows and values as columns

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

How to assemble a datset with with Likert or similar items as rows and values as columns

Art Kendall
WHO seems to be using an additional way of checking candidate items when building a scale.

I have started syntax to demo this.
I do not have much net access for now.
Please suggest a way to create the dataset in the middle of the syntax below.

*find "Aggregate adjacent endorsement frequency".
* this is an additional way to identify candidate scale items when the candidate item pool.
* is larger than the intended length of the scale to be created.
*. that may have peculiar distributions.
* this is based on the idea that if two adjacent values do not contain 10% of the cases.
* it should be re-examined.
*.
* cases and likert items no missing values generated.
new file.
input program.
   vector item (10,f3).
   loop id = 1 to 25.
      loop #p = 1 to 10.
         compute item(#p) =RND(RV.UNIFORM(.5,5.5)).
      end loop.
      end case.
   end loop.
   end file.
end input program.
value labels item1 to item10
   1 'Strongly disagree'
   2 'Disagree'
   3 'Neither'
   4 'Agree'
   5 'Strongly agree'.
dataset declare valuecounts.
* assemble a dataset named ValueCounts that has items as rows and counts of values as columns.
* first as a check create this as a table.
CTABLES
   /VLABELS VARIABLES=item1 item2 item3 item4 item5 item6 item7 item8 item9 item10
      DISPLAY=BOTH
   /TABLE item1 [COUNT F40.0] + item2 [COUNT F40.0] + item3 [COUNT F40.0] + item4 [COUNT F40.0]
      + item5 [COUNT F40.0] + item6 [COUNT F40.0] + item7 [COUNT F40.0] + item8 [COUNT F40.0]
      + item9 [COUNT F40.0] + item10 [COUNT F40.0]
   /CLABELS ROWLABELS=OPPOSITE
   /CATEGORIES VARIABLES=item1 item2 item3 item4 item5 item6 item7 item8 item9 item10
      ORDER=A KEY=VALUE EMPTY=INCLUDE.
* create the data set.
*.
******* Quick way to do this?.
*.
dataset activate ValueCounts.
Compute ResponseCount= Sum(ValCount1 to ValCount5).

numeric Compare1vs2 Compare2vs3 Compare3vs4 Compare4vs5 (Pct6.2).
numeric Flag1vs2    Flag2vs3    Flag3vs4    Flag4vs5(f1).
do repeat
   compare =  Compare1vs2 to Compare4vs5
   /flag    =  Flag1vs2    to Flag4vs5
   /myvar1  =  ValCount1   to ValCount4
   /myvar2  =  ValCount2   to ValCount5.
   compute compare = myvar1+myvar2 /ResponseCount.
   compute flag =compare lt .10.
end repeat.
list.






-- 
Art Kendall
Social Research Consultants
Art Kendall
Social Research Consultants
Reply | Threaded
Open this post in threaded view
|

Re: How to assemble a datset with with Likert or similar items as rows and values as columns

Maguin, Eugene

Art, I don’t understand what kind of dataset you are wanting to create. As I read your syntax, you create a 25 record, 10 item dataset and you then run Ctables on that dataset. Then what?

Gene Maguin

 

From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Art Kendall
Sent: Tuesday, March 11, 2014 11:18 AM
To: [hidden email]
Subject: How to assemble a datset with with Likert or similar items as rows and values as columns

 

WHO seems to be using an additional way of checking candidate items when building a scale.

I have started syntax to demo this.
I do not have much net access for now.
Please suggest a way to create the dataset in the middle of the syntax below.

*find "Aggregate adjacent endorsement frequency".
* this is an additional way to identify candidate scale items when the candidate item pool.
* is larger than the intended length of the scale to be created.
*. that may have peculiar distributions.
* this is based on the idea that if two adjacent values do not contain 10% of the cases.
* it should be re-examined.
*.
* cases and likert items no missing values generated.
new file.
input program.
   vector item (10,f3).
   loop id = 1 to 25.
      loop #p = 1 to 10.
         compute item(#p) =RND(RV.UNIFORM(.5,5.5)).
      end loop.
      end case.
   end loop.
   end file.
end input program.
value labels item1 to item10
   1 'Strongly disagree'
   2 'Disagree'
   3 'Neither'
   4 'Agree'
   5 'Strongly agree'.
dataset declare valuecounts.
* assemble a dataset named ValueCounts that has items as rows and counts of values as columns.
* first as a check create this as a table.
CTABLES
   /VLABELS VARIABLES=item1 item2 item3 item4 item5 item6 item7 item8 item9 item10
      DISPLAY=BOTH
   /TABLE item1 [COUNT F40.0] + item2 [COUNT F40.0] + item3 [COUNT F40.0] + item4 [COUNT F40.0]
      + item5 [COUNT F40.0] + item6 [COUNT F40.0] + item7 [COUNT F40.0] + item8 [COUNT F40.0]
      + item9 [COUNT F40.0] + item10 [COUNT F40.0]
   /CLABELS ROWLABELS=OPPOSITE
   /CATEGORIES VARIABLES=item1 item2 item3 item4 item5 item6 item7 item8 item9 item10
      ORDER=A KEY=VALUE EMPTY=INCLUDE.
* create the data set.
*.
******* Quick way to do this?.
*.
dataset activate ValueCounts.
Compute ResponseCount= Sum(ValCount1 to ValCount5).

numeric Compare1vs2 Compare2vs3 Compare3vs4 Compare4vs5 (Pct6.2).
numeric Flag1vs2    Flag2vs3    Flag3vs4    Flag4vs5(f1).
do repeat
   compare =  Compare1vs2 to Compare4vs5
   /flag    =  Flag1vs2    to Flag4vs5
   /myvar1  =  ValCount1   to ValCount4
   /myvar2  =  ValCount2   to ValCount5.
   compute compare = myvar1+myvar2 /ResponseCount.
   compute flag =compare lt .10.
end repeat.
list.







--
Art Kendall
Social Research Consultants

Art Kendall
Social Research Consultants

 


View this message in context: How to assemble a datset with with Likert or similar items as rows and values as columns
Sent from the SPSSX Discussion mailing list archive at Nabble.com.

Reply | Threaded
Open this post in threaded view
|

Re: How to assemble a datset with with Likert or similar items as rows and values as columns

Richard Ristow
In reply to this post by Art Kendall
2014-03-11 Kendall-How to assemble a datset with with Likert


At 11:18 AM 3/11/2014, Art Kendall wrote, asking how to restructure a
dataset of Likert responses into one where the responses are columns
and values are total counts, as in the following CTABLES table:
  [TestData]
|------|---------------|-----------|----------|--------|---------------|
|      |1  Strongly    |2  Disagree|3  Neither|4  Agree|5  Strongly    |
|      |disagree       |           |          |        |agree          |
|      |---------------|-----------|----------|--------|---------------|
|      |Count          |Count      |Count     |Count   |Count          |
|------|---------------|-----------|----------|--------|---------------|
|item01|6              |4          |5         |6       |4              |
|------|---------------|-----------|----------|--------|---------------|
|item02|3              |5          |5         |7       |5              |
|------|---------------|-----------|----------|--------|---------------|
|item03|6              |5          |1         |6       |7              |
|------|---------------|-----------|----------|--------|---------------|
|item04|6              |3          |5         |5       |6              |
|------|---------------|-----------|----------|--------|---------------|
|item05|3              |4          |8         |4       |6              |
|------|---------------|-----------|----------|--------|---------------|
|item06|9              |3          |1         |8       |4              |
|------|---------------|-----------|----------|--------|---------------|
|item07|3              |6          |3         |9       |4              |
|------|---------------|-----------|----------|--------|---------------|
|item08|5              |4          |6         |6       |4              |
|------|---------------|-----------|----------|--------|---------------|
|item09|2              |10         |7         |4       |2              |
|------|---------------|-----------|----------|--------|---------------|
|item10|6              |8          |4         |4       |3              |
|------|---------------|-----------|----------|--------|---------------|

The following syntax (with VARSTOCASES, AGGREGATE, CASESTOVARS) seems
to reproduce this table quite closely. It does not, however, appear
to be doing anything like what you were trying to do in dataset
ValueCounts. (By the by, among other problems, you did a "dataset
declare valuecounts." and a later "dataset activate ValueCounts."
with nothing between for that dataset; so, when you activated it, it
had no variables and no values.)

Anyway, here's what I did. I've renamed your variables 'item01' to
'item10', instead of 'item1' to 'item10', so the names sort properly.
As usual, complete code is in an Appendix following the listing.
*  ================================================================ .
*  Create a dataset mirroring the above table.                      .
*  (Code by Richard Ristow after this point)                        .
*  ================================================================ .
DATASET ACTIVATE  TestData WINDOW=FRONT.
DATASET COPY      Restruct.
DATASET ACTIVATE  Restruct WINDOW=FRONT.
VARSTOCASES
    /MAKE Response FROM item01 TO item10
    /INDEX = Item "Name of the item"(Response)
    /KEEP =  ID
    /NULL = KEEP.

Variables to Cases
|-----------------------------|---------------------------|
|Output Created               |11-MAR-2014 15:25:16       |
|-----------------------------|---------------------------|
  [Restruct]

Generated Variables
|--------|---------------|
|Name    |Label          |
|--------|---------------|
|Item    |Name of the    |
|        |item           |
|Response|<none>         |
|--------|---------------|
Processing Statistics [omitted]
|-------------|--|

DATASET DECLARE   ValueCounts.
AGGREGATE OUTFILE=ValueCounts
    /BREAK=item Response
    /Count 'Number of responses' = NU.
DATASET ACTIVATE  ValueCounts WINDOWS=FRONT.
STRING  #EdLabel (A21).
COMPUTE #EdLabel=VALUELABEL(Response).
COMPUTE #EdLabel=REPLACE(#EdLabel,' ','_').
COMPUTE #EdLabel=SUBSTR(#EdLabel,1,
                         LENGTH(RTRIM(VALUELABEL(Response)))).

STRING  ColHead  (A21).
COMPUTE ColHead = CONCAT('r.',
                          STRING(Response,F1),
                          '.',
                          #EdLabel).

CASESTOVARS
  /ID = Item
  /INDEX = ColHead
  /GROUPBY = VARIABLE
  /DROP    = Response.

Cases to Variables
|-----------------------------|---------------------------|
|Output Created               |11-MAR-2014 15:25:16       |
|-----------------------------|---------------------------|
  [ValueCounts]
Generated Variables [listing omitted]
Processing Statistics [omitted]

LIST.
List
|-----------------------------|---------------------------|
|Output Created               |11-MAR-2014 15:25:16       |
|-----------------------------|---------------------------|
  [ValueCounts]
        r.1.Strongl
Item   y_disagree  r.2.Disagree r.3.Neither r.4.Agree r.5.Strongly_agree

item01         6            4           5          6              4
item02         3            5           5          7              5
item03         6            5           1          6              7
item04         6            3           5          5              6
item05         3            4           8          4              6
item06         9            3           1          8              4
item07         3            6           3          9              4
item08         5            4           6          6              4
item09         2           10           7          4              2
item10         6            8           4          4              3

Number of cases read:  10    Number of cases listed:  10
*  ================================================================ .
================================
APPENDIX: Test data and all code
(WRR: not saved separately)
================================
*  ................................................................. .
*  .................   Test data               ..................... .
SET RNG = MT       /* 'Mersenne twister' random number generator  */ .
SET MTINDEX = 4433 /*  Providence, RI telephone book              */ .
new file.
input program.
    NUMERIC ID  (F4).
    NUMERIC      item01 TO item10 (F3).
    vector  item=item01 TO item10.
    loop id = 1001 to 1025.
       loop #p = 1 to 10.
          compute item(#p) =RND(RV.UNIFORM(.5,5.5)).
       end loop.
       end case.
    end loop.
    end file.
end input program.
value labels item01 to item10
    1 'Strongly disagree'
    2 'Disagree'
    3 'Neither'
    4 'Agree'
    5 'Strongly agree'.
VARIABLE LEVEL item01 TO item10 (ORDINAL).
DATASET NAME   TestData.

* assemble a dataset named ValueCounts that has items .
* as rows and counts of values as columns.            .
* first as a check create this as a table.            .

CTABLES
    /VLABELS    VARIABLES=item01 item02 item03 item04
                          item05 item06 item07 item08
                          item09 item10
       DISPLAY=BOTH
    /TABLE item01 [COUNT F40.0] + item02 [COUNT F40.0]
         + item03 [COUNT F40.0] + item04 [COUNT F40.0]
         + item05 [COUNT F40.0] + item06 [COUNT F40.0]
         + item07 [COUNT F40.0] + item08 [COUNT F40.0]
         + item09 [COUNT F40.0] + item10 [COUNT F40.0]
    /CLABELS ROWLABELS=OPPOSITE
    /CATEGORIES VARIABLES=item01 item02 item03 item04
                          item05 item06 item07 item08
                          item09 item10
       ORDER=A KEY=VALUE EMPTY=INCLUDE.
*  ================================================================ .
*  Create a dataset mirroring the above table.                      .
*  (Code by Richard Ristow after this point)                        .
*  ================================================================ .
DATASET ACTIVATE  TestData WINDOW=FRONT.
DATASET COPY      Restruct.
DATASET ACTIVATE  Restruct WINDOW=FRONT.
VARSTOCASES
    /MAKE Response FROM item01 TO item10
    /INDEX = Item "Name of the item"(Response)
    /KEEP =  ID
    /NULL = KEEP.

DATASET DECLARE   ValueCounts.
AGGREGATE OUTFILE=ValueCounts
    /BREAK=item Response
    /Count 'Number of responses' = NU.
DATASET ACTIVATE  ValueCounts WINDOWS=FRONT.

STRING  #EdLabel (A21).
COMPUTE #EdLabel=VALUELABEL(Response).
COMPUTE #EdLabel=REPLACE(#EdLabel,' ','_').
COMPUTE #EdLabel=SUBSTR(#EdLabel,1,
                         LENGTH(RTRIM(VALUELABEL(Response)))).

STRING  ColHead  (A21).
COMPUTE ColHead = CONCAT('r.',
                          STRING(Response,F1),
                          '.',
                          #EdLabel).

CASESTOVARS
  /ID = Item
  /INDEX = ColHead
  /GROUPBY = VARIABLE
  /DROP    = Response.

LIST.
*  ================================================================ .

=====================
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 assemble a datset with with Likert or similar items as rows and values as columns

Art Kendall
In reply to this post by Maguin, Eugene
I would like to have the data that is in the table as a dataset.
it would have rows that are indexed by the items and columns that are indexed by the response values.
The purpose of the CTABLE step was to demo what the contents of the dataset ValueCounts should be.
It would be used to show  that the syntax to obtain the working dataset was reasonable.

The demo syntax would
(1) make up some example Likert type data.
(2) put the frequencies for responses in the listing file.
(3) get a new dataset named ValueCounts that has items as rows and frequencies of responses as columns.
(4) apply the syntax at the end to flag the situation when two adjacent response values combined are used by 10% of fewer of the respondents.

Since I temporarily do not have good access to the net nor to my files I am looking for a way to do step 3.

Perhaps someday I'll try to generate a procedure that does not rely on a fixed number of items and that used dictionary info to find the number of response categories and items.
But for now I just wanted to demo what the scale development step some at WHO are recommending looks like.


Art Kendall
Social Research Consultants
On 3/11/2014 12:17 PM, Maguin, Eugene [via SPSSX Discussion] wrote:

Art, I don’t understand what kind of dataset you are wanting to create. As I read your syntax, you create a 25 record, 10 item dataset and you then run Ctables on that dataset. Then what?

Gene Maguin

 

From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Art Kendall
Sent: Tuesday, March 11, 2014 11:18 AM
To: [hidden email]
Subject: How to assemble a datset with with Likert or similar items as rows and values as columns

 

WHO seems to be using an additional way of checking candidate items when building a scale.

I have started syntax to demo this.
I do not have much net access for now.
Please suggest a way to create the dataset in the middle of the syntax below.

*find "Aggregate adjacent endorsement frequency".
* this is an additional way to identify candidate scale items when the candidate item pool.
* is larger than the intended length of the scale to be created.
*. that may have peculiar distributions.
* this is based on the idea that if two adjacent values do not contain 10% of the cases.
* it should be re-examined.
*.
* cases and likert items no missing values generated.
new file.
input program.
   vector item (10,f3).
   loop id = 1 to 25.
      loop #p = 1 to 10.
         compute item(#p) =RND(RV.UNIFORM(.5,5.5)).
      end loop.
      end case.
   end loop.
   end file.
end input program.
value labels item1 to item10
   1 'Strongly disagree'
   2 'Disagree'
   3 'Neither'
   4 'Agree'
   5 'Strongly agree'.
dataset declare valuecounts.
* assemble a dataset named ValueCounts that has items as rows and counts of values as columns.
* first as a check create this as a table.
CTABLES
   /VLABELS VARIABLES=item1 item2 item3 item4 item5 item6 item7 item8 item9 item10
      DISPLAY=BOTH
   /TABLE item1 [COUNT F40.0] + item2 [COUNT F40.0] + item3 [COUNT F40.0] + item4 [COUNT F40.0]
      + item5 [COUNT F40.0] + item6 [COUNT F40.0] + item7 [COUNT F40.0] + item8 [COUNT F40.0]
      + item9 [COUNT F40.0] + item10 [COUNT F40.0]
   /CLABELS ROWLABELS=OPPOSITE
   /CATEGORIES VARIABLES=item1 item2 item3 item4 item5 item6 item7 item8 item9 item10
      ORDER=A KEY=VALUE EMPTY=INCLUDE.
* create the data set.
*.
******* Quick way to do this?.
*.
dataset activate ValueCounts.
Compute ResponseCount= Sum(ValCount1 to ValCount5).

numeric Compare1vs2 Compare2vs3 Compare3vs4 Compare4vs5 (Pct6.2).
numeric Flag1vs2    Flag2vs3    Flag3vs4    Flag4vs5(f1).
do repeat
   compare =  Compare1vs2 to Compare4vs5
   /flag    =  Flag1vs2    to Flag4vs5
   /myvar1  =  ValCount1   to ValCount4
   /myvar2  =  ValCount2   to ValCount5.
   compute compare = myvar1+myvar2 /ResponseCount.
   compute flag =compare lt .10.
end repeat.
list.







--
Art Kendall
Social Research Consultants

Art Kendall
Social Research Consultants

 


View this message in context: How to assemble a datset with with Likert or similar items as rows and values as columns
Sent from the SPSSX Discussion mailing list archive at Nabble.com.




To start a new topic under SPSSX Discussion, email [hidden email]
To unsubscribe from SPSSX Discussion, click here.
NAML

Art Kendall
Social Research Consultants
Reply | Threaded
Open this post in threaded view
|

Re: How to assemble a datset with with Likert or similar items as rows and values as columns

David Marso
Administrator
In reply to this post by Art Kendall
compute compare = myvar1+myvar2 /ResponseCount.
??
compute compare = (myvar1+myvar2) /ResponseCount.

Art Kendall wrote
WHO seems to be using an additional way of checking
      candidate items when building a scale.
   
    I have started syntax to demo this.
    I do not have much net access for now.
    Please suggest a way to create the dataset in the middle of the
    syntax below.
   
    *find "Aggregate adjacent endorsement frequency".
      * this is an additional way to identify candidate scale items when
      the candidate item pool.
      * is larger than the intended length of the scale to be created.
      *. that may have peculiar distributions.
      * this is based on the idea that if two adjacent values do not
      contain 10% of the cases.
      * it should be re-examined.
      *.
      * cases and likert items no missing values generated.
      new file.
      input program.
         vector item (10,f3).
         loop id = 1 to 25.
            loop #p = 1 to 10.
               compute item(#p) =RND(RV.UNIFORM(.5,5.5)).
            end loop.
            end case.
         end loop.
         end file.
      end input program.
      value labels item1 to item10
         1 'Strongly disagree'
         2 'Disagree'
         3 'Neither'
         4 'Agree'
         5 'Strongly agree'.
      dataset declare valuecounts.
      * assemble a dataset named ValueCounts that has items as rows and
      counts of values as columns.
      * first as a check create this as a table.
      CTABLES
         /VLABELS VARIABLES=item1 item2 item3 item4 item5 item6 item7
      item8 item9 item10
            DISPLAY=BOTH
         /TABLE item1 [COUNT F40.0] + item2 [COUNT F40.0] + item3 [COUNT
      F40.0] + item4 [COUNT F40.0]
            + item5 [COUNT F40.0] + item6 [COUNT F40.0] + item7 [COUNT
      F40.0] + item8 [COUNT F40.0]
            + item9 [COUNT F40.0] + item10 [COUNT F40.0]
         /CLABELS ROWLABELS=OPPOSITE
         /CATEGORIES VARIABLES=item1 item2 item3 item4 item5 item6 item7
      item8 item9 item10
            ORDER=A KEY=VALUE EMPTY=INCLUDE.
      * create the data set.
      *.
      ******* Quick way to do this?.
      *.
      dataset activate ValueCounts.
      Compute ResponseCount= Sum(ValCount1 to ValCount5).
     
      numeric Compare1vs2 Compare2vs3 Compare3vs4 Compare4vs5 (Pct6.2).
      numeric Flag1vs2    Flag2vs3    Flag3vs4    Flag4vs5(f1).
      do repeat
         compare =  Compare1vs2 to Compare4vs5
         /flag    =  Flag1vs2    to Flag4vs5
         /myvar1  =  ValCount1   to ValCount4
         /myvar2  =  ValCount2   to ValCount5.
         compute compare = myvar1+myvar2 /ResponseCount.
         compute flag =compare lt .10.
      end repeat.
      list.
     
   
   
   
   
   
    --
Art Kendall
Social Research Consultants
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 assemble a datset with with Likert or similar items as rows and values as columns

Bruce Weaver
Administrator
In reply to this post by Art Kendall
Art, if I follow, you need to insert an OMS command.  Does the following give what you're after?

*find "Aggregate adjacent endorsement frequency".
* this is an additional way to identify candidate scale items when the candidate item pool.
* is larger than the intended length of the scale to be created.
*. that may have peculiar distributions.
* this is based on the idea that if two adjacent values do not contain 10% of the cases.
* it should be re-examined.
*.
* cases and likert items no missing values generated.
new file.
input program.
   vector item (10,f3).
   loop id = 1 to 25.
      loop #p = 1 to 10.
         compute item(#p) =RND(RV.UNIFORM(.5,5.5)).
      end loop.
      end case.
   end loop.
   end file.
end input program.
value labels item1 to item10
   1 'Strongly disagree'
   2 'Disagree'
   3 'Neither'
   4 'Agree'
   5 'Strongly agree'.

********************************** .
* OMS.
DATASET DECLARE  valuecounts.
OMS
  /SELECT TABLES
  /IF COMMANDS=['CTables'] SUBTYPES=['Custom Table']
  /DESTINATION FORMAT=SAV NUMBERED=TableNumber_
   OUTFILE='valuecounts'.

* assemble a dataset named ValueCounts that has items as rows and counts of values as columns.
* first as a check create this as a table.
CTABLES
   /VLABELS VARIABLES=item1 item2 item3 item4 item5 item6 item7 item8 item9 item10
      DISPLAY=BOTH
   /TABLE item1 [COUNT F40.0] + item2 [COUNT F40.0] + item3 [COUNT F40.0] + item4 [COUNT F40.0]
      + item5 [COUNT F40.0] + item6 [COUNT F40.0] + item7 [COUNT F40.0] + item8 [COUNT F40.0]
      + item9 [COUNT F40.0] + item10 [COUNT F40.0]
   /CLABELS ROWLABELS=OPPOSITE
   /CATEGORIES VARIABLES=item1 item2 item3 item4 item5 item6 item7 item8 item9 item10
      ORDER=A KEY=VALUE EMPTY=INCLUDE.
* create the data set.
*.
******* Quick way to do this?.
*.
OMSEND.
********************************** .

dataset activate ValueCounts.

********************************** .
RENAME VARIABLES ( Count to Count_D = ValCount1 to ValCount5).
********************************** .

Compute ResponseCount= Sum(ValCount1 to ValCount5).

numeric Compare1vs2 Compare2vs3 Compare3vs4 Compare4vs5 (Pct6.2).
numeric Flag1vs2    Flag2vs3    Flag3vs4    Flag4vs5(f1).
do repeat
   compare =  Compare1vs2 to Compare4vs5
   /flag    =  Flag1vs2    to Flag4vs5
   /myvar1  =  ValCount1   to ValCount4
   /myvar2  =  ValCount2   to ValCount5.
   compute compare = (myvar1+myvar2) /ResponseCount.
   compute flag =compare lt .10.
end repeat.
list Var1 to ResponseCount.
list Compare1vs2 to Flag4vs5.

OUTPUT:

[First LIST]

Var1   ValCount1 ValCount2 ValCount3 ValCount4 ValCount5 ResponseCount
 
item1      5         7         3         5         5           25.00
item2      6         5         3         3         8           25.00
item3      5         5         2         9         4           25.00
item4      7         5         7         4         2           25.00
item5      4         5         2         8         6           25.00
item6      7         5         7         2         4           25.00
item7      5         4         6         2         8           25.00
item8      4         9         5         3         4           25.00
item9      5         4         6         7         3           25.00
item10     4         1         8         3         9           25.00
 
Number of cases read:  10    Number of cases listed:  10

[Second LIST]

Compare1vs2 Compare2vs3 Compare3vs4 Compare4vs5 Flag1vs2 Flag2vs3 Flag3vs4 Flag4vs5
 
     .48%        .40%        .32%        .40%       0        0        0        0
     .44%        .32%        .24%        .44%       0        0        0        0
     .40%        .28%        .44%        .52%       0        0        0        0
     .48%        .48%        .44%        .24%       0        0        0        0
     .36%        .28%        .40%        .56%       0        0        0        0
     .48%        .48%        .36%        .24%       0        0        0        0
     .36%        .40%        .32%        .40%       0        0        0        0
     .52%        .56%        .32%        .28%       0        0        0        0
     .36%        .40%        .52%        .40%       0        0        0        0
     .20%        .36%        .44%        .48%       0        0        0        0
 
Number of cases read:  10    Number of cases listed:  10



Art Kendall wrote
I would like to have
        the data that is in the table as a dataset.
      it would have rows that are indexed by the items and columns that
      are indexed by the response values.
      The purpose of the CTABLE step was to demo what the contents of
      the dataset ValueCounts should be.
      It would be used to show  that the syntax to obtain the working
      dataset was reasonable.
     
      The demo syntax would
      (1) make up some example Likert type data.
      (2) put the frequencies for responses in the listing file.
      (3) get a new dataset named ValueCounts that has items as rows and
      frequencies of responses as columns.
      (4) apply the syntax at the end to flag the situation when two
      adjacent response values combined are used by 10% of fewer of the
      respondents.
     
      Since I temporarily do not have good access to the net nor to my
      files I am looking for a way to do step 3.
     
      Perhaps someday I'll try to generate a procedure that does not
      rely on a fixed number of items and that used dictionary info to
      find the number of response categories and items.
      But for now I just wanted to demo what the scale development step
      some at WHO are recommending looks like.
     
     
      Art Kendall
Social Research Consultants
      On 3/11/2014 12:17 PM, Maguin, Eugene [via SPSSX Discussion]
      wrote:
   
   
     
     
     
     
        Art,
            I don’t understand what kind of dataset you are wanting to
            create. As I read your syntax, you create a 25 record, 10
            item dataset and you then run Ctables on that dataset. Then
            what?
        Gene
            Maguin
         
        From:
            SPSSX(r) Discussion [mailto: [hidden
              email] ]
            On Behalf Of Art Kendall
            Sent: Tuesday, March 11, 2014 11:18 AM
            To: [hidden
              email]
            Subject: How to assemble a datset with with Likert or
            similar items as rows and values as columns
         
        WHO seems to
            be using an additional way of checking candidate items when
            building a scale.
         
          I have started syntax to demo this.
          I do not have much net access for now.
          Please suggest a way to create the dataset in the middle of
          the syntax below.
         
          *find "Aggregate adjacent
              endorsement frequency".
            * this is an additional way to identify candidate scale
              items when the candidate item pool.
            * is larger than the intended length of the scale to be
              created.
            *. that may have peculiar distributions.
            * this is based on the idea that if two adjacent values
              do not contain 10% of the cases.
            * it should be re-examined.
            *.
            * cases and likert items no missing values generated.
            new file.
            input program.
               vector item (10,f3).
               loop id = 1 to 25.
                  loop #p = 1 to 10.
                     compute item(#p) =RND(RV.UNIFORM(.5,5.5)).
                  end loop.
                  end case.
               end loop.
               end file.
            end input program.
            value labels item1 to item10
               1 'Strongly disagree'
               2 'Disagree'
               3 'Neither'
               4 'Agree'
               5 'Strongly agree'.
            dataset declare valuecounts.
            * assemble a dataset named ValueCounts that has items as
              rows and counts of values as columns.
            * first as a check create this as a table.
            CTABLES
               /VLABELS VARIABLES=item1 item2 item3 item4 item5
              item6 item7 item8 item9 item10
                  DISPLAY=BOTH
               /TABLE item1 [COUNT F40.0] + item2 [COUNT F40.0] +
              item3 [COUNT F40.0] + item4 [COUNT F40.0]
                  + item5 [COUNT F40.0] + item6 [COUNT F40.0] +
              item7 [COUNT F40.0] + item8 [COUNT F40.0]
                  + item9 [COUNT F40.0] + item10 [COUNT F40.0]
               /CLABELS ROWLABELS=OPPOSITE
               /CATEGORIES VARIABLES=item1 item2 item3 item4 item5
              item6 item7 item8 item9 item10
                  ORDER=A KEY=VALUE EMPTY=INCLUDE.
            * create the data set.
            *.
            ******* Quick way to do this?.
            *.
            dataset activate ValueCounts.
            Compute ResponseCount= Sum(ValCount1 to ValCount5).
           
            numeric Compare1vs2 Compare2vs3 Compare3vs4 Compare4vs5
              (Pct6.2).
            numeric Flag1vs2    Flag2vs3    Flag3vs4   
              Flag4vs5(f1).
            do repeat
               compare =  Compare1vs2 to Compare4vs5
               /flag    =  Flag1vs2    to Flag4vs5
               /myvar1  =  ValCount1   to ValCount4
               /myvar2  =  ValCount2   to ValCount5.
               compute compare = myvar1+myvar2 /ResponseCount.
               compute flag =compare lt .10.
            end repeat.
            list.
           
         
         
         
         
         
         
         
        --
        Art Kendall
        Social Research Consultants
       
          Art Kendall
              Social Research Consultants
       
         
       
         
       
        View this message in context:
            How to assemble a datset with with Likert or similar items
            as rows and values as columns
          Sent from the SPSSX
            Discussion mailing list archive  at Nabble.com.
     
     
     
     
     
        If you reply to this email, your
          message will be added to the discussion below:
        http://spssx-discussion.1045642.n5.nabble.com/How-to-assemble-a-datset-with-with-Likert-or-similar-items-as-rows-and-values-as-columns-tp5724824p5724825.html 
     
     
        To start a new topic under SPSSX Discussion, email
        [hidden email] 
        To unsubscribe from SPSSX Discussion, click
          here .
        NAML
--
Bruce Weaver
bweaver@lakeheadu.ca
http://sites.google.com/a/lakeheadu.ca/bweaver/

"When all else fails, RTFM."

PLEASE NOTE THE FOLLOWING: 
1. My Hotmail account is not monitored regularly. To send me an e-mail, please use the address shown above.
2. The SPSSX Discussion forum on Nabble is no longer linked to the SPSSX-L listserv administered by UGA (https://listserv.uga.edu/).
Reply | Threaded
Open this post in threaded view
|

Re: How to assemble a datset with with Likert or similar items as rows and values as columns

Richard Ristow
At 04:44 PM 3/11/2014, Bruce Weaver wrote:

>Art, if I follow, you need to insert an OMS command.  Does the following give
>what you're after?

Nice one. I'm a good hand with transformation commands, and I brought
it off that way; but this is much less complicated.

=====================
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 assemble a datset with with Likert or similar items as rows and values as columns

David Marso
Administrator
In reply to this post by Bruce Weaver
Skip OMS just need AGGREGATE a hammer and a screwdriver (V2C and C2V).
Note this solution does NOT require knowing how many categories are involved or any messy DO REPEAT logic. Also doesn't require CTABLES.

*<DataSim -built so we get some skewed items for testing flags->.
NEW FILE.
DATASET DECLARE raw.
MATRIX.
SAVE TRUNC( UNIFORM(1000,10)*5+1) / OUTFILE raw / VARIABLES item01 TO item10.
END MATRIX.
DATASET ACTIVATE raw.
DO REPEAT v=item01 TO item10.
COMPUTE v=ABS(TRUNC(NORMAL(1.25)))+1  .
END REPEAT.
*</DataSim>.

COMPUTE ID=$CASENUM.
 value labels item01 to item10
    1 'Strongly disagree'
    2 'Disagree'
    3 'Neither'
    4 'Agree'
    5 'Strongly agree'.
FREQUENCIES ALL.

VARSTOCASES / MAKE values FROM item01 to item10 / INDEX=ind_val (values).
AGGREGATE OUTFILE * / BREAK ind_val values / Nvalue=N.
AGGREGATE OUTFILE *  MODE ADDVARIABLES / BREAK ind_val / Total=SUM(NValue).
COMPUTE PctInCat=NValue/Total.
IF $CASENUM GT 1 AND LAG(ind_val) EQ ind_val  Cum2Cat=SUM(PctInCat,LAG(pctInCat))*100.
COMPUTE flag10=Cum2Cat LT 10.
FORMATS values (F1.0).
EXECUTE.
DELETE VARIABLES  pctInCat.
CASESTOVARS ID=ind_val /INDEX values.

Bruce Weaver wrote
Art, if I follow, you need to insert an OMS command.  Does the following give what you're after?

*find "Aggregate adjacent endorsement frequency".
* this is an additional way to identify candidate scale items when the candidate item pool.
* is larger than the intended length of the scale to be created.
*. that may have peculiar distributions.
* this is based on the idea that if two adjacent values do not contain 10% of the cases.
* it should be re-examined.
*.
* cases and likert items no missing values generated.
new file.
input program.
   vector item (10,f3).
   loop id = 1 to 25.
      loop #p = 1 to 10.
         compute item(#p) =RND(RV.UNIFORM(.5,5.5)).
      end loop.
      end case.
   end loop.
   end file.
end input program.
value labels item1 to item10
   1 'Strongly disagree'
   2 'Disagree'
   3 'Neither'
   4 'Agree'
   5 'Strongly agree'.

********************************** .
* OMS.
DATASET DECLARE  valuecounts.
OMS
  /SELECT TABLES
  /IF COMMANDS=['CTables'] SUBTYPES=['Custom Table']
  /DESTINATION FORMAT=SAV NUMBERED=TableNumber_
   OUTFILE='valuecounts'.

* assemble a dataset named ValueCounts that has items as rows and counts of values as columns.
* first as a check create this as a table.
CTABLES
   /VLABELS VARIABLES=item1 item2 item3 item4 item5 item6 item7 item8 item9 item10
      DISPLAY=BOTH
   /TABLE item1 [COUNT F40.0] + item2 [COUNT F40.0] + item3 [COUNT F40.0] + item4 [COUNT F40.0]
      + item5 [COUNT F40.0] + item6 [COUNT F40.0] + item7 [COUNT F40.0] + item8 [COUNT F40.0]
      + item9 [COUNT F40.0] + item10 [COUNT F40.0]
   /CLABELS ROWLABELS=OPPOSITE
   /CATEGORIES VARIABLES=item1 item2 item3 item4 item5 item6 item7 item8 item9 item10
      ORDER=A KEY=VALUE EMPTY=INCLUDE.
* create the data set.
*.
******* Quick way to do this?.
*.
OMSEND.
********************************** .

dataset activate ValueCounts.

********************************** .
RENAME VARIABLES ( Count to Count_D = ValCount1 to ValCount5).
********************************** .

Compute ResponseCount= Sum(ValCount1 to ValCount5).

numeric Compare1vs2 Compare2vs3 Compare3vs4 Compare4vs5 (Pct6.2).
numeric Flag1vs2    Flag2vs3    Flag3vs4    Flag4vs5(f1).
do repeat
   compare =  Compare1vs2 to Compare4vs5
   /flag    =  Flag1vs2    to Flag4vs5
   /myvar1  =  ValCount1   to ValCount4
   /myvar2  =  ValCount2   to ValCount5.
   compute compare = (myvar1+myvar2) /ResponseCount.
   compute flag =compare lt .10.
end repeat.
list Var1 to ResponseCount.
list Compare1vs2 to Flag4vs5.

OUTPUT:

[First LIST]

Var1   ValCount1 ValCount2 ValCount3 ValCount4 ValCount5 ResponseCount
 
item1      5         7         3         5         5           25.00
item2      6         5         3         3         8           25.00
item3      5         5         2         9         4           25.00
item4      7         5         7         4         2           25.00
item5      4         5         2         8         6           25.00
item6      7         5         7         2         4           25.00
item7      5         4         6         2         8           25.00
item8      4         9         5         3         4           25.00
item9      5         4         6         7         3           25.00
item10     4         1         8         3         9           25.00
 
Number of cases read:  10    Number of cases listed:  10

[Second LIST]

Compare1vs2 Compare2vs3 Compare3vs4 Compare4vs5 Flag1vs2 Flag2vs3 Flag3vs4 Flag4vs5
 
     .48%        .40%        .32%        .40%       0        0        0        0
     .44%        .32%        .24%        .44%       0        0        0        0
     .40%        .28%        .44%        .52%       0        0        0        0
     .48%        .48%        .44%        .24%       0        0        0        0
     .36%        .28%        .40%        .56%       0        0        0        0
     .48%        .48%        .36%        .24%       0        0        0        0
     .36%        .40%        .32%        .40%       0        0        0        0
     .52%        .56%        .32%        .28%       0        0        0        0
     .36%        .40%        .52%        .40%       0        0        0        0
     .20%        .36%        .44%        .48%       0        0        0        0
 
Number of cases read:  10    Number of cases listed:  10



Art Kendall wrote
I would like to have
        the data that is in the table as a dataset.
      it would have rows that are indexed by the items and columns that
      are indexed by the response values.
      The purpose of the CTABLE step was to demo what the contents of
      the dataset ValueCounts should be.
      It would be used to show  that the syntax to obtain the working
      dataset was reasonable.
     
      The demo syntax would
      (1) make up some example Likert type data.
      (2) put the frequencies for responses in the listing file.
      (3) get a new dataset named ValueCounts that has items as rows and
      frequencies of responses as columns.
      (4) apply the syntax at the end to flag the situation when two
      adjacent response values combined are used by 10% of fewer of the
      respondents.
     
      Since I temporarily do not have good access to the net nor to my
      files I am looking for a way to do step 3.
     
      Perhaps someday I'll try to generate a procedure that does not
      rely on a fixed number of items and that used dictionary info to
      find the number of response categories and items.
      But for now I just wanted to demo what the scale development step
      some at WHO are recommending looks like.
     
     
      Art Kendall
Social Research Consultants
      On 3/11/2014 12:17 PM, Maguin, Eugene [via SPSSX Discussion]
      wrote:
   
   
     
     
     
     
        Art,
            I don’t understand what kind of dataset you are wanting to
            create. As I read your syntax, you create a 25 record, 10
            item dataset and you then run Ctables on that dataset. Then
            what?
        Gene
            Maguin
         
        From:
            SPSSX(r) Discussion [mailto: [hidden
              email] ]
            On Behalf Of Art Kendall
            Sent: Tuesday, March 11, 2014 11:18 AM
            To: [hidden
              email]
            Subject: How to assemble a datset with with Likert or
            similar items as rows and values as columns
         
        WHO seems to
            be using an additional way of checking candidate items when
            building a scale.
         
          I have started syntax to demo this.
          I do not have much net access for now.
          Please suggest a way to create the dataset in the middle of
          the syntax below.
         
          *find "Aggregate adjacent
              endorsement frequency".
            * this is an additional way to identify candidate scale
              items when the candidate item pool.
            * is larger than the intended length of the scale to be
              created.
            *. that may have peculiar distributions.
            * this is based on the idea that if two adjacent values
              do not contain 10% of the cases.
            * it should be re-examined.
            *.
            * cases and likert items no missing values generated.
            new file.
            input program.
               vector item (10,f3).
               loop id = 1 to 25.
                  loop #p = 1 to 10.
                     compute item(#p) =RND(RV.UNIFORM(.5,5.5)).
                  end loop.
                  end case.
               end loop.
               end file.
            end input program.
            value labels item1 to item10
               1 'Strongly disagree'
               2 'Disagree'
               3 'Neither'
               4 'Agree'
               5 'Strongly agree'.
            dataset declare valuecounts.
            * assemble a dataset named ValueCounts that has items as
              rows and counts of values as columns.
            * first as a check create this as a table.
            CTABLES
               /VLABELS VARIABLES=item1 item2 item3 item4 item5
              item6 item7 item8 item9 item10
                  DISPLAY=BOTH
               /TABLE item1 [COUNT F40.0] + item2 [COUNT F40.0] +
              item3 [COUNT F40.0] + item4 [COUNT F40.0]
                  + item5 [COUNT F40.0] + item6 [COUNT F40.0] +
              item7 [COUNT F40.0] + item8 [COUNT F40.0]
                  + item9 [COUNT F40.0] + item10 [COUNT F40.0]
               /CLABELS ROWLABELS=OPPOSITE
               /CATEGORIES VARIABLES=item1 item2 item3 item4 item5
              item6 item7 item8 item9 item10
                  ORDER=A KEY=VALUE EMPTY=INCLUDE.
            * create the data set.
            *.
            ******* Quick way to do this?.
            *.
            dataset activate ValueCounts.
            Compute ResponseCount= Sum(ValCount1 to ValCount5).
           
            numeric Compare1vs2 Compare2vs3 Compare3vs4 Compare4vs5
              (Pct6.2).
            numeric Flag1vs2    Flag2vs3    Flag3vs4   
              Flag4vs5(f1).
            do repeat
               compare =  Compare1vs2 to Compare4vs5
               /flag    =  Flag1vs2    to Flag4vs5
               /myvar1  =  ValCount1   to ValCount4
               /myvar2  =  ValCount2   to ValCount5.
               compute compare = myvar1+myvar2 /ResponseCount.
               compute flag =compare lt .10.
            end repeat.
            list.
           
         
         
         
         
         
         
         
        --
        Art Kendall
        Social Research Consultants
       
          Art Kendall
              Social Research Consultants
       
         
       
         
       
        View this message in context:
            How to assemble a datset with with Likert or similar items
            as rows and values as columns
          Sent from the SPSSX
            Discussion mailing list archive  at Nabble.com.
     
     
     
     
     
        If you reply to this email, your
          message will be added to the discussion below:
        http://spssx-discussion.1045642.n5.nabble.com/How-to-assemble-a-datset-with-with-Likert-or-similar-items-as-rows-and-values-as-columns-tp5724824p5724825.html 
     
     
        To start a new topic under SPSSX Discussion, email
        [hidden email] 
        To unsubscribe from SPSSX Discussion, click
          here .
        NAML
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 assemble a datset with with Likert or similar items as rows and values as columns

Bruce Weaver
Administrator
To get David's code to run, I had to change OUTFILE raw to OUTFILE *, as shown on the SAVE line below.  (I think this "bug" in MATRIX has come up before.)  

MATRIX.
SAVE TRUNC( UNIFORM(1000,10)*5+1) / OUTFILE * / VARIABLES item01 TO item10.
END MATRIX.


David Marso wrote
Skip OMS just need AGGREGATE a hammer and a screwdriver (V2C and C2V).
Note this solution does NOT require knowing how many categories are involved or any messy DO REPEAT logic. Also doesn't require CTABLES.

*<DataSim -built so we get some skewed items for testing flags->.
NEW FILE.
DATASET DECLARE raw.
MATRIX.
SAVE TRUNC( UNIFORM(1000,10)*5+1) / OUTFILE raw / VARIABLES item01 TO item10.
END MATRIX.
DATASET ACTIVATE raw.
DO REPEAT v=item01 TO item10.
COMPUTE v=ABS(TRUNC(NORMAL(1.25)))+1  .
END REPEAT.
*</DataSim>.

COMPUTE ID=$CASENUM.
 value labels item01 to item10
    1 'Strongly disagree'
    2 'Disagree'
    3 'Neither'
    4 'Agree'
    5 'Strongly agree'.
FREQUENCIES ALL.

VARSTOCASES / MAKE values FROM item01 to item10 / INDEX=ind_val (values).
AGGREGATE OUTFILE * / BREAK ind_val values / Nvalue=N.
AGGREGATE OUTFILE *  MODE ADDVARIABLES / BREAK ind_val / Total=SUM(NValue).
COMPUTE PctInCat=NValue/Total.
IF $CASENUM GT 1 AND LAG(ind_val) EQ ind_val  Cum2Cat=SUM(PctInCat,LAG(pctInCat))*100.
COMPUTE flag10=Cum2Cat LT 10.
FORMATS values (F1.0).
EXECUTE.
DELETE VARIABLES  pctInCat.
CASESTOVARS ID=ind_val /INDEX values.

Bruce Weaver wrote
Art, if I follow, you need to insert an OMS command.  Does the following give what you're after?

*find "Aggregate adjacent endorsement frequency".
* this is an additional way to identify candidate scale items when the candidate item pool.
* is larger than the intended length of the scale to be created.
*. that may have peculiar distributions.
* this is based on the idea that if two adjacent values do not contain 10% of the cases.
* it should be re-examined.
*.
* cases and likert items no missing values generated.
new file.
input program.
   vector item (10,f3).
   loop id = 1 to 25.
      loop #p = 1 to 10.
         compute item(#p) =RND(RV.UNIFORM(.5,5.5)).
      end loop.
      end case.
   end loop.
   end file.
end input program.
value labels item1 to item10
   1 'Strongly disagree'
   2 'Disagree'
   3 'Neither'
   4 'Agree'
   5 'Strongly agree'.

********************************** .
* OMS.
DATASET DECLARE  valuecounts.
OMS
  /SELECT TABLES
  /IF COMMANDS=['CTables'] SUBTYPES=['Custom Table']
  /DESTINATION FORMAT=SAV NUMBERED=TableNumber_
   OUTFILE='valuecounts'.

* assemble a dataset named ValueCounts that has items as rows and counts of values as columns.
* first as a check create this as a table.
CTABLES
   /VLABELS VARIABLES=item1 item2 item3 item4 item5 item6 item7 item8 item9 item10
      DISPLAY=BOTH
   /TABLE item1 [COUNT F40.0] + item2 [COUNT F40.0] + item3 [COUNT F40.0] + item4 [COUNT F40.0]
      + item5 [COUNT F40.0] + item6 [COUNT F40.0] + item7 [COUNT F40.0] + item8 [COUNT F40.0]
      + item9 [COUNT F40.0] + item10 [COUNT F40.0]
   /CLABELS ROWLABELS=OPPOSITE
   /CATEGORIES VARIABLES=item1 item2 item3 item4 item5 item6 item7 item8 item9 item10
      ORDER=A KEY=VALUE EMPTY=INCLUDE.
* create the data set.
*.
******* Quick way to do this?.
*.
OMSEND.
********************************** .

dataset activate ValueCounts.

********************************** .
RENAME VARIABLES ( Count to Count_D = ValCount1 to ValCount5).
********************************** .

Compute ResponseCount= Sum(ValCount1 to ValCount5).

numeric Compare1vs2 Compare2vs3 Compare3vs4 Compare4vs5 (Pct6.2).
numeric Flag1vs2    Flag2vs3    Flag3vs4    Flag4vs5(f1).
do repeat
   compare =  Compare1vs2 to Compare4vs5
   /flag    =  Flag1vs2    to Flag4vs5
   /myvar1  =  ValCount1   to ValCount4
   /myvar2  =  ValCount2   to ValCount5.
   compute compare = (myvar1+myvar2) /ResponseCount.
   compute flag =compare lt .10.
end repeat.
list Var1 to ResponseCount.
list Compare1vs2 to Flag4vs5.

OUTPUT:

[First LIST]

Var1   ValCount1 ValCount2 ValCount3 ValCount4 ValCount5 ResponseCount
 
item1      5         7         3         5         5           25.00
item2      6         5         3         3         8           25.00
item3      5         5         2         9         4           25.00
item4      7         5         7         4         2           25.00
item5      4         5         2         8         6           25.00
item6      7         5         7         2         4           25.00
item7      5         4         6         2         8           25.00
item8      4         9         5         3         4           25.00
item9      5         4         6         7         3           25.00
item10     4         1         8         3         9           25.00
 
Number of cases read:  10    Number of cases listed:  10

[Second LIST]

Compare1vs2 Compare2vs3 Compare3vs4 Compare4vs5 Flag1vs2 Flag2vs3 Flag3vs4 Flag4vs5
 
     .48%        .40%        .32%        .40%       0        0        0        0
     .44%        .32%        .24%        .44%       0        0        0        0
     .40%        .28%        .44%        .52%       0        0        0        0
     .48%        .48%        .44%        .24%       0        0        0        0
     .36%        .28%        .40%        .56%       0        0        0        0
     .48%        .48%        .36%        .24%       0        0        0        0
     .36%        .40%        .32%        .40%       0        0        0        0
     .52%        .56%        .32%        .28%       0        0        0        0
     .36%        .40%        .52%        .40%       0        0        0        0
     .20%        .36%        .44%        .48%       0        0        0        0
 
Number of cases read:  10    Number of cases listed:  10



Art Kendall wrote
I would like to have
        the data that is in the table as a dataset.
      it would have rows that are indexed by the items and columns that
      are indexed by the response values.
      The purpose of the CTABLE step was to demo what the contents of
      the dataset ValueCounts should be.
      It would be used to show  that the syntax to obtain the working
      dataset was reasonable.
     
      The demo syntax would
      (1) make up some example Likert type data.
      (2) put the frequencies for responses in the listing file.
      (3) get a new dataset named ValueCounts that has items as rows and
      frequencies of responses as columns.
      (4) apply the syntax at the end to flag the situation when two
      adjacent response values combined are used by 10% of fewer of the
      respondents.
     
      Since I temporarily do not have good access to the net nor to my
      files I am looking for a way to do step 3.
     
      Perhaps someday I'll try to generate a procedure that does not
      rely on a fixed number of items and that used dictionary info to
      find the number of response categories and items.
      But for now I just wanted to demo what the scale development step
      some at WHO are recommending looks like.
     
     
      Art Kendall
Social Research Consultants
      On 3/11/2014 12:17 PM, Maguin, Eugene [via SPSSX Discussion]
      wrote:
   
   
     
     
     
     
        Art,
            I don’t understand what kind of dataset you are wanting to
            create. As I read your syntax, you create a 25 record, 10
            item dataset and you then run Ctables on that dataset. Then
            what?
        Gene
            Maguin
         
        From:
            SPSSX(r) Discussion [mailto: [hidden
              email] ]
            On Behalf Of Art Kendall
            Sent: Tuesday, March 11, 2014 11:18 AM
            To: [hidden
              email]
            Subject: How to assemble a datset with with Likert or
            similar items as rows and values as columns
         
        WHO seems to
            be using an additional way of checking candidate items when
            building a scale.
         
          I have started syntax to demo this.
          I do not have much net access for now.
          Please suggest a way to create the dataset in the middle of
          the syntax below.
         
          *find "Aggregate adjacent
              endorsement frequency".
            * this is an additional way to identify candidate scale
              items when the candidate item pool.
            * is larger than the intended length of the scale to be
              created.
            *. that may have peculiar distributions.
            * this is based on the idea that if two adjacent values
              do not contain 10% of the cases.
            * it should be re-examined.
            *.
            * cases and likert items no missing values generated.
            new file.
            input program.
               vector item (10,f3).
               loop id = 1 to 25.
                  loop #p = 1 to 10.
                     compute item(#p) =RND(RV.UNIFORM(.5,5.5)).
                  end loop.
                  end case.
               end loop.
               end file.
            end input program.
            value labels item1 to item10
               1 'Strongly disagree'
               2 'Disagree'
               3 'Neither'
               4 'Agree'
               5 'Strongly agree'.
            dataset declare valuecounts.
            * assemble a dataset named ValueCounts that has items as
              rows and counts of values as columns.
            * first as a check create this as a table.
            CTABLES
               /VLABELS VARIABLES=item1 item2 item3 item4 item5
              item6 item7 item8 item9 item10
                  DISPLAY=BOTH
               /TABLE item1 [COUNT F40.0] + item2 [COUNT F40.0] +
              item3 [COUNT F40.0] + item4 [COUNT F40.0]
                  + item5 [COUNT F40.0] + item6 [COUNT F40.0] +
              item7 [COUNT F40.0] + item8 [COUNT F40.0]
                  + item9 [COUNT F40.0] + item10 [COUNT F40.0]
               /CLABELS ROWLABELS=OPPOSITE
               /CATEGORIES VARIABLES=item1 item2 item3 item4 item5
              item6 item7 item8 item9 item10
                  ORDER=A KEY=VALUE EMPTY=INCLUDE.
            * create the data set.
            *.
            ******* Quick way to do this?.
            *.
            dataset activate ValueCounts.
            Compute ResponseCount= Sum(ValCount1 to ValCount5).
           
            numeric Compare1vs2 Compare2vs3 Compare3vs4 Compare4vs5
              (Pct6.2).
            numeric Flag1vs2    Flag2vs3    Flag3vs4   
              Flag4vs5(f1).
            do repeat
               compare =  Compare1vs2 to Compare4vs5
               /flag    =  Flag1vs2    to Flag4vs5
               /myvar1  =  ValCount1   to ValCount4
               /myvar2  =  ValCount2   to ValCount5.
               compute compare = myvar1+myvar2 /ResponseCount.
               compute flag =compare lt .10.
            end repeat.
            list.
           
         
         
         
         
         
         
         
        --
        Art Kendall
        Social Research Consultants
       
          Art Kendall
              Social Research Consultants
       
         
       
         
       
        View this message in context:
            How to assemble a datset with with Likert or similar items
            as rows and values as columns
          Sent from the SPSSX
            Discussion mailing list archive  at Nabble.com.
     
     
     
     
     
        If you reply to this email, your
          message will be added to the discussion below:
        http://spssx-discussion.1045642.n5.nabble.com/How-to-assemble-a-datset-with-with-Likert-or-similar-items-as-rows-and-values-as-columns-tp5724824p5724825.html 
     
     
        To start a new topic under SPSSX Discussion, email
        [hidden email] 
        To unsubscribe from SPSSX Discussion, click
          here .
        NAML
--
Bruce Weaver
bweaver@lakeheadu.ca
http://sites.google.com/a/lakeheadu.ca/bweaver/

"When all else fails, RTFM."

PLEASE NOTE THE FOLLOWING: 
1. My Hotmail account is not monitored regularly. To send me an e-mail, please use the address shown above.
2. The SPSSX Discussion forum on Nabble is no longer linked to the SPSSX-L listserv administered by UGA (https://listserv.uga.edu/).
Reply | Threaded
Open this post in threaded view
|

Re: How to assemble a datset with with Likert or similar items as rows and values as columns

David Marso
Administrator
What version of SPSS?
I know the MATRIX b-hole doesn't like to read from data sets (PLEASE FIX THIS -should take a code intern about 15 minutes or 2 monkeys an hour-).
I has a distinct taste for disk files and *.
What foul error message is emitted from the inner sanctum?
--
Bruce Weaver wrote
To get David's code to run, I had to change OUTFILE raw to OUTFILE *, as shown on the SAVE line below.  (I think this "bug" in MATRIX has come up before.)  

MATRIX.
SAVE TRUNC( UNIFORM(1000,10)*5+1) / OUTFILE * / VARIABLES item01 TO item10.
END MATRIX.

<SNIP>
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 assemble a datset with with Likert or similar items as rows and values as columns

Bruce Weaver
Administrator
Good catch--I should have reported version and OS!

  Version 21.0.0.2 (64-bit)
  OS:  Windoze 7 Professional (SP1)


I just tried again to run this first part of your syntax:

*<DataSim -built so we get some skewed items for testing flags->.
NEW FILE.
DATASET DECLARE raw.
MATRIX.
SAVE TRUNC( UNIFORM(1000,10)*5+1) / OUTFILE raw / VARIABLES item01 TO item10.
END MATRIX.
DATASET ACTIVATE raw.

Here is the output:

--- Start of output ---

Matrix

>Error # 34 in column 45.  Text: raw
>SPSS Statistics cannot access a file with the given file specification.  The
>file specification is either syntactically invalid, specifies an invalid
>drive, specifies a protected directory, specifies a protected file, or
>specifies a non-sharable file.
>Execution of this command stops.
Run MATRIX procedure:
 
------ END MATRIX -----

Dataset Activate raw.

Warnings
Dataset raw has no data.
Execution of this command stops.

--- End of output ---

If I comment out or delete the DATASET commands and change raw to * on the SAVE, everything works.  ;-)




David Marso wrote
What version of SPSS?
I know the MATRIX b-hole doesn't like to read from data sets (PLEASE FIX THIS -should take a code intern about 15 minutes or 2 monkeys an hour-).
I has a distinct taste for disk files and *.
What foul error message is emitted from the inner sanctum?
--
Bruce Weaver wrote
To get David's code to run, I had to change OUTFILE raw to OUTFILE *, as shown on the SAVE line below.  (I think this "bug" in MATRIX has come up before.)  

MATRIX.
SAVE TRUNC( UNIFORM(1000,10)*5+1) / OUTFILE * / VARIABLES item01 TO item10.
END MATRIX.

<SNIP>
--
Bruce Weaver
bweaver@lakeheadu.ca
http://sites.google.com/a/lakeheadu.ca/bweaver/

"When all else fails, RTFM."

PLEASE NOTE THE FOLLOWING: 
1. My Hotmail account is not monitored regularly. To send me an e-mail, please use the address shown above.
2. The SPSSX Discussion forum on Nabble is no longer linked to the SPSSX-L listserv administered by UGA (https://listserv.uga.edu/).
Reply | Threaded
Open this post in threaded view
|

Re: How to assemble a datset with with Likert or similar items as rows and values as columns

Art Kendall
In reply to this post by Richard Ristow
Thank you all.

Will post syntax as "Aggregate adjacent endorsement frequency for checking scale item distributions"
Art Kendall
Social Research Consultants
On 3/11/2014 5:16 PM, Richard Ristow [via SPSSX Discussion] wrote:
At 04:44 PM 3/11/2014, Bruce Weaver wrote:

>Art, if I follow, you need to insert an OMS command.  Does the following give
>what you're after?

Nice one. I'm a good hand with transformation commands, and I brought
it off that way; but this is much less complicated.

=====================
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 start a new topic under SPSSX Discussion, email [hidden email]
To unsubscribe from SPSSX Discussion, click here.
NAML

Art Kendall
Social Research Consultants