spssforum.com

by SPSS users, for SPSS users
SPSSVideoTutor.com
It is currently Wed Jun 19, 2013 12:26 am

All times are UTC




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Creating an index
PostPosted: Tue Sep 06, 2011 2:03 pm 
Offline

Joined: Tue Sep 06, 2011 1:23 pm
Posts: 1
Well, Hello Everyone, this will be my first post. I am a german student of sociology and i am supposed to work for one of my lecturers. It is basically the first time i am using SPSS but i have to work with a rather complex, huge dataset (http://www.share-project.org/sharelife/).

I have to deal with the following problem. The interview data consists of hundreds of variables, interviewees were sometimes asked the same question several times, e. g. "In which year did you start your [first/next] paid job (as employee or self employed), which lasted for 6 months or more?" Intrviewees were asked this question as often as they started new paid jobs during theire lives.

As a consequence out of this there are lots of variables which are almost labelled identically, e.g. sl_ac006_1, sl_ac006_2, sl_ac005_6, sl_ac006_6 and so on.

I want to make use of this. The following syntax is a simplified example of what i am doing right now. You do not have to pay attention to the compute expressions but to the variable names, specifically the endings.

Quote:
do if (sl_ac006_5 GE umzuegealter and sl_ac005_5 EQ 1).
COMPUTE umzuege = umzuege + 1.
end if.

do IF (sl_ac006_6 GE umzuegealter and sl_ac005_6 EQ 1).
COMPUTE umzuege = umzuege + 1.
End if.

do if (sl_ac006_7 GE umzuegealter and sl_ac005_7 EQ 1).
COMPUTE umzuege = umzuege + 1.
end if.


I am searching for an possibilty code an index that will replace the end of my variable names with an index in order to create a general loop syntax that might somehow look like this. I hope you get the idea.

Quote:
LOOP #i=5 TO 7.
DOIF (sl_ac005_#i GE umzuegealter and sl_ac006_#i)
Compute umzuege = umzuege + 1.
end if.


(I already tried very weird conversions of the variable names and and an numeric index into a string variable using the CONCAT command but i gave up.)

Perhaps you can give me some advice how to solve this problem. There are lots of variables with indexes i have to work with and a solution might save me alot of time and trouble.

Jan


Top
 Profile  
 
 Post subject: Re: Creating an index
PostPosted: Tue Sep 06, 2011 3:45 pm 
Offline
Moderator

Joined: Tue Jun 10, 2008 4:50 pm
Posts: 437
take a look at this:
http://www.yac.com.pl/mt.texts.spss-do-repeat.en.html


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 2 guests


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:  
Powered by phpBB® Forum Software © phpBB Group