Rearranging variables

Moderators: statman, Analyst Techy, andris, Fierce, GerineL, Smash

spss_newbie
Posts: 2
Joined: Fri Apr 04, 2008 10:25 am

Rearranging variables

Postby spss_newbie » Fri Apr 04, 2008 1:37 pm

Hi folks,

I need some help in writing a syntax to rearrange the variables and save them to a new dataset.

Original (data view):
age income height
1 age1 income1 height1
2 age2
3 age3 income3

What syntax can I use to "rearrange" the variables to the following?
demo
1 age1
2 income1
3 height1
4 age2
5 age3
6 income3

Thanks so much for yor help!!
Smash
Moderator
Posts: 233
Joined: Tue Aug 07, 2007 11:48 am

Postby Smash » Fri Apr 11, 2008 12:07 am

Let say your variables have got names: age, income, height and they are same type (numerical or string with same lenght), do Restucturing variables into cases. Additionally add the index and id to know which case and variable originally it was.

Code: Select all

VARSTOCASES /ID = id
 /MAKE trans1 FROM age income height
 /INDEX = Index1(3)
 /KEEP =
 /NULL = KEEP.

Who is online

Users browsing this forum: No registered users and 1 guest

cron