Split file with 2 variable

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

perola.rike
Posts: 3
Joined: Mon Sep 24, 2012 7:56 am

Split file with 2 variable

Postby perola.rike » Mon Sep 24, 2012 8:02 am

I need a syntax script that produces an output with descriptives for two categorical variables - Diagnose and Gender.
This below is for one variable (Diagnose), but I need two...


DATASET ACTIVATE DataSet1.
SORT CASES BY Klarert_dikotom.
SPLIT FILE BY DIAGNOSE

DESCRIPTIVES VARIABLES=AGE
/STATISTICS=MEAN STDDEV MIN MAX.

SPLIT FILE OFF.
Penguin_Knight
Posts: 473
Joined: Thu Apr 05, 2012 5:58 pm

Re: Split file with 2 variable

Postby Penguin_Knight » Mon Sep 24, 2012 10:56 am

Create a new variable that is a combination of diagnosis and gender, like:

1: Male without disease
2: Male with disease
3: Female without disease
4: Female with disease

Then split the file with this new variable.
perola.rike
Posts: 3
Joined: Mon Sep 24, 2012 7:56 am

Re: Split file with 2 variable

Postby perola.rike » Mon Sep 24, 2012 12:25 pm

OK, thanks. So it isnt a particular script I can write in syntax without creating a new variable?
Penguin_Knight
Posts: 473
Joined: Thu Apr 05, 2012 5:58 pm

Re: Split file with 2 variable

Postby Penguin_Knight » Mon Sep 24, 2012 6:47 pm

Actually there is. You can also add extra variables:

Code: Select all

SORT CASES  BY sex race.
SPLIT FILE LAYERED BY sex race.
This should have the same effect.

If you're not sure how the syntax should be written, use Data > Split File, Choose compare groups, and the put **both** your grouping variables underneath. Click "Paste" for the syntax.
perola.rike
Posts: 3
Joined: Mon Sep 24, 2012 7:56 am

Re: Split file with 2 variable

Postby perola.rike » Tue Sep 25, 2012 1:15 pm

Yes! It worked!

SPLIT FILE LAYERED did the trick, thanks.

Who is online

Users browsing this forum: No registered users and 1 guest

cron