Friday, 12 January 2007

Transposing cases and variables

Two most common commands are generally used for data transposing. FLIP command creates a new data file in which the rows adn columns in the original data are transposed so that cases (rows) become variables (columns) or vice versa. CASETOVAR command is in this manner more complex method where one can namely restructure data not only by flipping rows and columns.

Let's say you want to read (or import) the Excel spreadsheet and transpose the rows and columns:

[Syntax]
GET DATA /TYPE=XSL
/FILE='C:\example.xsl'
/READNAMES=ON.
FLIP VARIABLES=Sport Devices Cars
/NEWNAME=V1.
RENAME VARIABLES (CASE_LBL= Type).
[/Syntax]

Readnames=on reads the first row of the excel spreadsheet as variable names. The original variables names (sport, devices, cars) are automatically stored as values in a new variable called CASE_LBL. Subsequent rename variables command changed the name of this vvariable to Type.

[EXCEL DATA]
SPORT DEVICES CARS
ID 12 32 33
STORE 2 5 4
COST 12,000 32,200 1,000
[/EXCEL DATA]

[Transposed data in SPSS]
Type ID STORE COST
1 SPORT 12 2 12,000
2 DEVICES 32 5 32,200
3 CARS 33 4 1,000
[/Transposed data in SPSS]*
*in DataView

5 comments:

gethqnet said...

Thanks for such a great post and the review, I am totally impressed! Keep stuff like this coming.
Michael Jackson

Anonymous said...

The COURAGE COWARDLY DOG
application I'm creating is a photo album, plus a secret link unlocking extra pictures secret extra features are a common occurrence in commercial COURAGE COWARDLY DOG DVD
. The image directory eventually will hold the completed COURAGE COWARDLY DOG DVD COLLECTION
.
c

nisha said...

Good post. I really like the way that you explained.
bba

ugg store said...

Well worth to read this article, thanks for sharing this information. With this article you offered me got a chance to know about this, anyway i say Great Article! and waiting for you next article about this interesting subject.

Microsoft Office 2007 said...

NEVERTHELESS, THE CIVIL LAW is and must be neutral about who has a more noble or rewarding faith. The breakaway parishes ought to win every Office 2010facet of the lawsuit not becauseMicrosoft Office 2010 their beliefs or their politics are better, Microsoft wordbut because both lawOffice 2007and equity, along with common sense, are on Microsoft Officetheir side.Microsoft Office 2007 Not only does Virginia state law (the Division Statute)Office 2007 keyexplicitly apply to just such a Office 2007 downloadsituation as now exists, but the history Office 2007 Professionalespecially of The Falls Church argues against the claims of Outlook 2010the Virginia Diocese with which theyMicrosoft outlookhave disassociated.Microsoft outlook 2010First, The Falls Church wasWindows 7 founded, formed, and developed long before the diocese, or the national Episcopal Church, even existed.