Merging 2 datasets

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

treppy76
Posts: 2
Joined: Fri Mar 01, 2013 2:30 pm

Merging 2 datasets

Postby treppy76 » Thu Jul 25, 2013 2:23 pm

Hi all,

I have 2 datasets I want to merge but I do not know the syntax is not working.

Can you help please?

Code: Select all


data list list
 /id Male.
begin data.
 147 1 
 108 0 
  18 0 
 153 0 
  50 0 
  51 1 
 102 0 
  57 1 
 160 1
 136 0 1
end data.
sort cases by all.
DATASET NAME a1 WINDOW=FRONT.

data list list
 /id female .
begin data.
 147 3 
 108 4 
  18 5 
 153 0 
  50 0 
  51 1 
 102 0 
  58 3 
 159 44 
 136 0 
end data.
sort cases by all.
DATASET NAME a2 WINDOW=FRONT.

DATASET ACTIVATE a2.
STAR JOIN
  /SELECT t0.female, t1.Male
  /FROM * AS t0
  /JOIN 'a1' AS t1
    ON t0.id=t1.id
  /OUTFILE FILE=*.

jgardner
Posts: 4
Joined: Sun Jul 29, 2012 6:41 pm

Re: Merging 2 datasets

Postby jgardner » Wed Jan 08, 2014 11:22 pm

It's hard to tell the problem without the error report from your output. But, it could be that your key variables (the ones that you're matching the two datasets on) are not sorted in the same manner. It could also be that there are duplicates across these key variables in both datasets (at least one dataset should be unduplicated). Some additional information about the errors you're seeing would be helpful if those are not the culprits.

Who is online

Users browsing this forum: No registered users and 2 guests

cron