how to merge multiple columns into one

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

cg_ruiz
Posts: 1
Joined: Thu Jul 04, 2013 8:26 pm

how to merge multiple columns into one

Postby cg_ruiz » Thu Jul 04, 2013 8:51 pm

Hi all,

I'm having trouble understanding how to merge multiple columns into one taking as a reference a key variable. My data is as follows:

Dataset 1 - Medications User 1
ID/ MEDICATION1/ DOSE1/ DURATION1/ MEDICATION2/ DOSE2/ DURATION3/
1 Advil 100 mg 3 days Xanax 5 mg 10 days
2 Tylenol 50 mg 2 days Lyrica 1 mg 1 day
3 Dolex 10 mg 1 days Beta 5 mg 2 days

I would like to obtain the following dataset:
ID/ MEDICATION/ DOSE/ DURATION/
1 Advil 100 mg 3 days
1 Xanax 5 mg 10 days
2 Tylenol 50 mg 2 days
2 Lyrica 1 mg 1 day
3 Dolex 10 mg 1 days
3 Beta 5 mg 2 days

Thanks,

Carlos
statman
Administrator
Posts: 2735
Joined: Tue Jun 12, 2007 12:08 pm
Location: Florida, USA

Re: how to merge multiple columns into one

Postby statman » Fri Jul 05, 2013 1:49 pm

Look into the Concatenate command
See the note below

NOTE: Please read the Posting Guidelines and always tell us your OS, the SPSS version and information about your study and data!

Statman
Statistical Services

Who is online

Users browsing this forum: No registered users and 1 guest

cron