How to rotate a base

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

How to rotate a base

Alexandra Chirilov-2

Hello,

 

Can anyone help me with a syntax which would help me to rotate a database in SPSS?

 

My database show like this:

(all the possible combinations, all the products are shown at exactly same number of times)

 

Respondent1    Product A      Evaluation for prod A      Product B    Evaluation for product B   ………………………

Respondent2    Product B      Evaluation for prod B      Product A    Evaluation for product A ……………………….

Respondent3    Product C      Evaluation for prod C      Product A    Evaluation for product A………………………….

Respondent4    Product C      Evaluation for prod C      Product C    Evaluation for product C…………………………

Respondent5    Product D      Evaluation for prod D      Product D   Evaluation for product D…………………………

Respondent6    Product A      Evaluation for prod A      Product B    Evaluation for product B………………………….

 

 

And I need my database to look like:

(I want to create specific columns for each attribute)

 

Respondent1    Product A      Evaluation for prod A      Product B    Evaluation for product B   ………………………

Respondent2    Product A      Evaluation for prod A      Product B    Evaluation for product B ……………………….

Respondent3    Product A      Evaluation for prod A      Product B    Evaluation for product B………………………….

Respondent4    Product A      Evaluation for prod A      Product B    Evaluation for product B…………………………

Respondent5    Product A      Evaluation for prod A      Product B    Evaluation for product B…………………………

Respondent6    Product A      Evaluation for prod A      Product B    Evaluation for product B………………………….

 

 

Thank you very much,

Alexandra

Reply | Threaded
Open this post in threaded view
|

Re: How to rotate a base

Luca Meyer-3
<base href="x-msg://64/">Hello Alexandra,

If nobody has already provided you with the solution - I am currently reading-writing offline - I would suggest to create new variables compared to the one you have and then fill then in with the proper content.

Suppose you have:
(1) RESP as first variable and the V1, V2, ... , V7, V8 as following SPSS variables (next to each other).
(2) A numeric evaluation for each product (let's say for 1 to 10)

This (untested) syntax should give you 4 variables (PROD_A ... PROD_D) in this order with the evaluation for each of the 4 products:

NUMERIC PROD_A PROD_B PROD_C PROD_D (F2.0).
IF V1="Product A" PROD_A=V2.
IF V1="Product B" PROD_B=V2.
IF V1="Product C" PROD_C=V2.
IF V1="Product D" PROD_D=V2.
IF V3="Product A" PROD_A=V4.
IF V3="Product B" PROD_B=V4.
IF V3="Product C" PROD_C=V4.
IF V3="Product D" PROD_D=V4.
IF V5="Product A" PROD_A=V6.
IF V5="Product B" PROD_B=V6.
IF V5="Product C" PROD_C=V6.
IF V5="Product D" PROD_D=V6.
IF V7="Product A" PROD_A=V8.
IF V7="Product B" PROD_B=V8.
IF V7="Product C" PROD_C=V8.
IF V7="Product D" PROD_D=V8.
EXE.

Cheers,
Luca

Luca Meyer
www.lucameyer.com
PASW Statistics v. 18.0.2 (2-apr-2010)
R version 2.9.2 (2009-08-24)
Mac OS X 10.6.4 (10F569) - kernel Darwin 10.4.0

Il giorno 03/ago/2010, alle ore 11.51, Alexandra Chirilov ha scritto:

Hello,
 
Can anyone help me with a syntax which would help me to rotate a database in SPSS?
 
My database show like this:
(all the possible combinations, all the products are shown at exactly same number of times)
 
Respondent1    Product A      Evaluation for prod A      Product B    Evaluation for product B   ………………………
Respondent2    Product B      Evaluation for prod B      Product A    Evaluation for product A ……………………….
Respondent3    Product C      Evaluation for prod C      Product A    Evaluation for product A………………………….
Respondent4    Product C      Evaluation for prod C      Product C    Evaluation for product C…………………………
Respondent5    Product D      Evaluation for prod D      Product D   Evaluation for product D…………………………
Respondent6    Product A      Evaluation for prod A      Product B    Evaluation for product B………………………….
 
 
And I need my database to look like:
(I want to create specific columns for each attribute)
 
Respondent1    Product A      Evaluation for prod A      Product B    Evaluation for product B   ………………………
Respondent2    Product A      Evaluation for prod A      Product B    Evaluation for product B ……………………….
Respondent3    Product A      Evaluation for prod A      Product B    Evaluation for product B………………………….
Respondent4    Product A      Evaluation for prod A      Product B    Evaluation for product B…………………………
Respondent5    Product A      Evaluation for prod A      Product B    Evaluation for product B…………………………
Respondent6    Product A      Evaluation for prod A      Product B    Evaluation for product B………………………….
 
 
Thank you very much,
Alexandra