Solved

Creating Variables in SPSS 12.0

Posted on 2008-06-16
5
953 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
  • 3
  • 2
5 Comments
 
LVL 22

Expert Comment

by:Reid Palmeira
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Storage devices are generally used to save the data or sometime transfer the data from one computer system to another system. However, sometimes user accidentally erased their important data from the Storage devices. Users have to know how data reco…
The article will include the best Data Recovery Tools along with their Features, Capabilities, and their Download Links. Hope you’ll enjoy it and will choose the one as required by you.
This video demonstrates how to use each tool, their shortcuts, where and when to use them, and how to use the keyboard to improve workflow.
This video will demonstrate how to find the puppet warp tool from the edit menu and where to put the points to edit.

771 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now