Create data in spss with the syntax editor

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

Bropamht
Posts: 2
Joined: Mon Sep 25, 2017 9:20 pm

Create data in spss with the syntax editor

Postby Bropamht » Mon Sep 25, 2017 9:36 pm

Hi everyone, I'm a new spss user. I have a problem, i have to a new variable with an old one witch is a string variable. My syntax should do this :

If (OldVariable contain 'text')
Do{
NewVariable =1;
}else {
NewVariable = 0;
}

Text is a part of the string in the fields of OldVariable

I tried all I knew with no success, so if anyone can write the appropriate syntax for me this would be great! Thanks ya'll.
statman
Administrator
Posts: 2723
Joined: Tue Jun 12, 2007 12:08 pm
Location: Florida, USA

Re: Create data in spss with the syntax editor

Postby statman » Tue Sep 26, 2017 12:09 pm

Need more like .......
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
Bropamht
Posts: 2
Joined: Mon Sep 25, 2017 9:20 pm

Re: Create data in spss with the syntax editor

Postby Bropamht » Wed Sep 27, 2017 9:23 am

Sorry!!!

OS : Windows 10.
Version : SPSS 23.
My study concern the knowledge of the new baby's mother about nutrition, so the guy who was responsible of the survey made a mistake on extracting the data from the server.
that's make the "multiple choice questions" (i don't know if it's the correct way to say it but it's like check box choice in html) have many different answers in the same cell of one variable. so i want to split this variable in binary variable for each answer, for that i have to indentify the cells who have a specific part of text to create these binary variable to continue the analyse.
IsaacWi
Posts: 1
Joined: Mon Oct 23, 2017 9:04 am

Re: Create data in spss with the syntax editor

Postby IsaacWi » Tue Oct 31, 2017 8:14 am

Did you solve your problem? I think the same syntax would work for me too.
statman
Administrator
Posts: 2723
Joined: Tue Jun 12, 2007 12:08 pm
Location: Florida, USA

Re: Create data in spss with the syntax editor

Postby statman » Thu Nov 02, 2017 12:57 pm

So you have several responses to 1 question? The person can enter several different answers, e.g., What do you look for in a car? Answers could be 'color,' 'transmission,' 'style,' ...... all then loaded into separate fields?

Who is online

Users browsing this forum: No registered users and 1 guest

cron