spssforum.com from users, for users

SPSSforum.com is the largest free SPSS help resource worldwide.
On this SPSS forum you are sure to get an answer to your question!
Join the forum and let other SPSS users help you.

Join the SPSS users Group on LinkedIn
Join the SPSS Users Group
on LinkedIn
 
SPSSforum.com is a forum for SPSS users. Ask any question you like about SPSS or statistics.

It is currently Thu Sep 09, 2010 4:29 pm

All times are UTC




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: Simplifying complicated output
PostPosted: Tue Mar 02, 2010 8:23 pm 
Offline

Joined: Mon Dec 14, 2009 7:02 pm
Posts: 7
Hello, I have a large dataset I want to perform regression on. There are two things I'd like to be able to do:

1) Divide the dataset into smaller datasets and have separate regressions for each of them. I want all the results on the same graph.
2) Instead of having hundreds of points I'd like all of the points with the same x value to be averaged.

Are these things possible? If so can you please tell me how they're done?

Thanks in advance.


Top
 Profile  
 



 Post subject: Re: Simplifying complicated output
PostPosted: Wed Mar 03, 2010 6:44 am 
Offline
Moderator

Joined: Mon Apr 27, 2009 2:19 am
Posts: 278
Location: Melbourne, Australia, University
Hi RobinReborn.

In SPSS>File>New>Syntax and copy the syntax below.

Adapt code to your own variable names.

1. The key changes are to "grpvar" and change values 1 2 3 e.g. to !SplitDataSets 11 12 13/.
2. The key name changes are to "XVar" and "YVar".


/* Created by Analyst Techy 03 Mar 2010

/* 1. Divide the dataset into smaller datasets

/* Splits a dataset up by a grouping variable e.g. grpvar
/* for this syntax to work you have to have a numeric variable named grpvar
/* The grp values are 1, 2,3 within the variable grpvar
/* Assuming a recent version of SPSS
/* Open SPSS sav file before running



DEFINE !SplitDataSets (!POS !CHAREND ('/'))

!DO !gv !IN (!1)

!LET !SepSets = !CONCAT('SepDataSet',!gv)

DATASET COPY !SepSets.
DATASET ACTIVATE !SepSets.
FILTER OFF.
USE ALL.
SELECT IF (grpvar = !gv).
EXECUTE.

!DOEND

!ENDDEFINE.

!SplitDataSets 1 2 3/.


/* 2. Same XVar averaged to YVar
/* for this syntax to work you have to have a numeric variable named grpvar
/* Assuming a recent version of SPSS
/* Open SPSS sav file before running

DATASET DECLARE SameXAvgY.
SORT CASES BY XVar.
AGGREGATE
/OUTFILE='SameXAvgY'
/PRESORTED
/BREAK=XVar
/YVar_mean=MEAN(YVar).

_________________
Analyst Techy

NOTES:
1. It is not ethical for me to provide complete answers to assignment/work solutions.
2. Any solutions I provide on this forum are free of charge, donations go towards the maintenance of the unaffiliated SPSS forum.


Top
 Profile  
 
 Post subject: Re: Simplifying complicated output
PostPosted: Wed Mar 10, 2010 8:43 pm 
Offline

Joined: Mon Dec 14, 2009 7:02 pm
Posts: 7
Thanks so much for the help but I am still a bit confused. I haven't ever created SPSS syntax before. When I did what you told me, I got three new windows with no data in them. I did change the appropriate variable to grpvar, when I tried changing

!SplitDataSets 1 2 3/

to

!SplitDataSets 0 4 5 9/ (those being the values corresponding to the four sets of data I want to be separated)

I just got four empty windows. What exactly do I need to change?

Also, I do not need to separate the data into multiple files, I need each data set to be on the same graph with a different regression for it.


Top
 Profile  
 
 Post subject: Re: Simplifying complicated output
PostPosted: Fri Mar 19, 2010 4:48 am 
Offline
Moderator

Joined: Mon Apr 27, 2009 2:19 am
Posts: 278
Location: Melbourne, Australia, University
Hi RobinReborn.

Sorry about the delay, I check my messages when I have a spare moment.

OK the first thing to make sure before running your syntax is to make sure you have the SPSS data SAV file open and active (active is when you see a + plus sign on the minimised file (bottom of the screen toolbar).

Its probably best to change your dataset variable names to what I have in the syntax-so you know it works right. From memory the 2 x separate syntaxes were not intended to be run in order or at the same time. So just highlight /* 1. dito and /* 2. dito on 2 separate occasions.

The fact that you said there were 4 x windows, tells me the syntax is working-I am also assuming there were no error messages in the output window log (please make sure you have noot suppressed your error messages).

The chances are its probably the wrong active file is being run (+ sign), or you have not changed the variable names correctly in the syntax.

Can you please copy and paste my amended syntax into the forum reply, and I see if you have made sufficient changes.

_________________
Analyst Techy

NOTES:
1. It is not ethical for me to provide complete answers to assignment/work solutions.
2. Any solutions I provide on this forum are free of charge, donations go towards the maintenance of the unaffiliated SPSS forum.


Top
 Profile  
 



Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Template made by DEVPPL

This site is in no way connected with SPSS Inc. or any affiliate of SPPS Inc. The SPSS logo and products are owned by and copyrighted by SPSS Inc. The views expressed in the messages posted on this site are those of persons writing those comments and not necessarily those of the SPSSforum.com. SPSSforum.com does not vouch for the accuracy or truthfulness of any posted statement or opinion. The SPSSforum.com has, however, refrained from posting any item containing any statement known to be inaccurate, false or baseless.