Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Creating Variables in SPSS 12.0

Posted on 2008-06-16
5
Medium Priority
?
996 Views
Last Modified: 2008-07-22
Hi All,

I'm not sure why this simple line of code JUST doesn't seem to work for me. I am trying to create variables in SPSS and assign types and labels for them and while attempting the following code

DATA LIST FREE /
test
test123
test1 (a8).

I keep getting the error:

">Error # 4385. Command name: DATA LIST
>More variables appeared in the variable list than formats were specified
>for.
>This command not executed."

I need to use syntax to build the variables, assign the types, give them a width, decimals, add labels, and values but if I can't even give them a type, I can't move forward.

Any help is very highly appreciated. Please, help!

I am new to SPSS and therefore a newbie. Any help would be very seriously appreciated here!
0
Comment
Question by:piyushdabomb
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 22

Expert Comment

by:Reid Palmeira
ID: 21829638
typically with spss when you're not pulling the data from a file (or file=inline) you use a "begin data." and "end data." command to signal the software that you're entering the data set.

There's a decent introductory level tutorial for SPSS here: http://its.unm.edu/introductions/Spss_tutorial/session1.html

so in your case it would be something like:

DATA LIST FREE / var1 var 2
begin data.
test 1
test123 2
test1 (a8)
end data.
0
 
LVL 22

Expert Comment

by:Reid Palmeira
ID: 21829663
sorry, typos in the above, didn't watch my spaces...simplified it a bit:

DATA LIST FREE / var1
begin data.
test1
test12
test123
end data.
0
 

Author Comment

by:piyushdabomb
ID: 21831219
Thank  you for your commend. Why would I need to use begin data and end data if I have no data?

I am trying to build an empty spreadsheet with variables, labels, and specifying each variable with a numeric/string value. It sounds somewhat awkward, but that is my motive behind this. I tried to process the following commands and still unsuccessful!

DATA LIST FREE /
var1
var2 (a8)
var3
var4 (a4)
begin data.
end data.

I still get the same error. Any clues as to why this won't work?
0
 
LVL 22

Expert Comment

by:Reid Palmeira
ID: 21835169
ah. okay sorry i thought the test123 stuff was the data set you were trying to enter. so I'm going to steal a line from the link i posted here:

so after the / define the variable name, the columns and the data format (alpha or number). If you have four variables like ID, NAME, AGE, HEIGHT it might look like the command below. don't forget to use the / to indicate a new data line and the ; to end the line.

DATA LIST FREE / ID 1-5 NAME 7-14 (A) STATE 16-17 (A) HEIGHT 19-20;



then the
0
 

Accepted Solution

by:
piyushdabomb earned 0 total points
ID: 21835342
It works, however it doesn't seem to work if I declare it with the following instead:

DATA LIST FREE / ID 1-5 NAME 7-14 STATE 16-17 (A) HEIGHT 19-20 (A);
0

Featured Post

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This guide will walk you through the essential considerations and tech stack for building scalable websites. Know how to grow your business the smart way!
Want to know how to use Exchange Server Eseutil command? Go through this article as it gives you the know-how.
This video shows how use content aware, what it’s used for, and when to use it over other tools.
This video Micro Tutorial shows how to password-protect PDF files with free software. Many software products can do this, such as Adobe Acrobat (but not Adobe Reader), Nuance PaperPort, and Nuance Power PDF, but they are not free products. This vide…

721 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question