Restructure problem

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

Restructure problem

Muir Houston-3
Hi listers
I have been trying to restructure my data from long to wide format. The data contains details of school pupils examination results. I have a number of variables which I want to have only one entry for:
 
'scn'; 'Survey_number'; 'Forename'; 'Surname'; 'DoB'; 'Post_Code'; 'centre'; 'School'; 'sex'
 
the unique identifier is 'scn' (Scottish Candidate Number)

the following variables are the ones which have multiple entries and which I want to transform into variables. The range of possible multiple cases is 1 - 12 (all are numeric variables)

 'qual'; 'result'; 'year'; 'Subject_title'

I have tried the Restructure Wizard without success. I think one of the issues is I am not sure what should be Identifiers and if I should have an Index (es) and if so what would it be.

Also how should the data be sorted before the procedure? The following is one of my unsuccessful attempts

SORT CASES BY qual result year Subject_title .
CASESTOVARS
  /ID=qual result year Subject_title
  /GROUPBY=VARIABLE.

thanks

Muir

 

Dr Muir Houston
Social Justice, Place and Lifelong Education Research
School of Education
College of Social Sciences
University of Glasgow
0141-330-4699
 
R3L+ Project - Adult education in the light of the European Quality
Strategy
http://www.learning-regions.net/

GINCO Project - Grundtvig International Network of Course Organisers
http://www.ginconet.eu/

Reply | Threaded
Open this post in threaded view
|

Re: Restructure problem - almost sorted

Muir Houston-3
Listers
after some more perseverance I have been able to accomplish what I was hoping (see below) - well almost.
 
using the following syntax resulted in the correct number of cases in the new long file - however, it also gave me multiple entries for all variables except 'scn' so I had 'Forename.1 to Forename.11 and the same for sex, DoB etc.
 
these are easy enough to eliminate by hand in variable view for example but could the syntax be modified to resolve the issues.
 
SORT CASES BY scn .
CASESTOVARS
  /ID=scn
  /GROUPBY=INDEX.
 
Dr Muir Houston
Social Justice, Place and Lifelong Education Research
School of Education
College of Social Sciences
University of Glasgow
0141-330-4699
 
R3L+ Project - Adult education in the light of the European Quality
Strategy
http://www.learning-regions.net/

GINCO Project - Grundtvig International Network of Course Organisers
http://www.ginconet.eu/



From: Muir Houston
Sent: Wed 26/01/2011 14:40
To: [hidden email]
Subject: Restructure problem

Hi listers
I have been trying to restructure my data from long to wide format. The data contains details of school pupils examination results. I have a number of variables which I want to have only one entry for:
 
'scn'; 'Survey_number'; 'Forename'; 'Surname'; 'DoB'; 'Post_Code'; 'centre'; 'School'; 'sex'
 
the unique identifier is 'scn' (Scottish Candidate Number)

the following variables are the ones which have multiple entries and which I want to transform into variables. The range of possible multiple cases is 1 - 12 (all are numeric variables)

 'qual'; 'result'; 'year'; 'Subject_title'

I have tried the Restructure Wizard without success. I think one of the issues is I am not sure what should be Identifiers and if I should have an Index (es) and if so what would it be.

Also how should the data be sorted before the procedure? The following is one of my unsuccessful attempts

SORT CASES BY qual result year Subject_title .
CASESTOVARS
  /ID=qual result year Subject_title
  /GROUPBY=VARIABLE.

thanks

Muir

 

Dr Muir Houston
Social Justice, Place and Lifelong Education Research
School of Education
College of Social Sciences
University of Glasgow
0141-330-4699
 
R3L+ Project - Adult education in the light of the European Quality
Strategy
http://www.learning-regions.net/

GINCO Project - Grundtvig International Network of Course Organisers
http://www.ginconet.eu/

Reply | Threaded
Open this post in threaded view
|

Re: Restructure problem - almost sorted

Bruce Weaver
Administrator
Add a /FIXED subcommand, and list any variables for which you do not want multiple copies.

SORT CASES BY scn .
CASESTOVARS
  /ID=scn
  /GROUPBY=INDEX
  /FIXED = forename surname sex DoB .


Muir Houston-3 wrote
Listers
after some more perseverance I have been able to accomplish what I was hoping (see below) - well almost.

using the following syntax resulted in the correct number of cases in the new long file - however, it also gave me multiple entries for all variables except 'scn' so I had 'Forename.1 to Forename.11 and the same for sex, DoB etc.

these are easy enough to eliminate by hand in variable view for example but could the syntax be modified to resolve the issues.

SORT CASES BY scn .
CASESTOVARS
  /ID=scn
  /GROUPBY=INDEX.


Dr Muir Houston
Social Justice, Place and Lifelong Education Research
School of Education
College of Social Sciences
University of Glasgow
0141-330-4699

R3L+ Project - Adult education in the light of the European Quality
Strategy
http://www.learning-regions.net/

GINCO Project - Grundtvig International Network of Course Organisers
http://www.ginconet.eu/





From: Muir Houston
Sent: Wed 26/01/2011 14:40
To: SPSSX-L@LISTSERV.UGA.EDU
Subject: Restructure problem


Hi listers
I have been trying to restructure my data from long to wide format. The data contains details of school pupils examination results. I have a number of variables which I want to have only one entry for:

'scn'; 'Survey_number'; 'Forename'; 'Surname'; 'DoB'; 'Post_Code'; 'centre'; 'School'; 'sex'

the unique identifier is 'scn' (Scottish Candidate Number)
the following variables are the ones which have multiple entries and which I want to transform into variables. The range of possible multiple cases is 1 - 12 (all are numeric variables)
 'qual'; 'result'; 'year'; 'Subject_title'
I have tried the Restructure Wizard without success. I think one of the issues is I am not sure what should be Identifiers and if I should have an Index (es) and if so what would it be.
Also how should the data be sorted before the procedure? The following is one of my unsuccessful attempts
SORT CASES BY qual result year Subject_title .
CASESTOVARS
  /ID=qual result year Subject_title
  /GROUPBY=VARIABLE.
thanks
Muir

Dr Muir Houston
Social Justice, Place and Lifelong Education Research
School of Education
College of Social Sciences
University of Glasgow
0141-330-4699

R3L+ Project - Adult education in the light of the European Quality
Strategy
http://www.learning-regions.net/

GINCO Project - Grundtvig International Network of Course Organisers
http://www.ginconet.eu/
--
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/).