Solved

Creating Variables in SPSS 12.0

Posted on 2008-06-16
5
977 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

Webinar: Aligning, Automating, Winning

Join Dan Russo, Senior Manager of Operations Intelligence, for an in-depth discussion on how Dealertrack, leading provider of integrated digital solutions for the automotive industry, transformed their DevOps processes to increase collaboration and move with greater velocity.

Question has a verified solution.

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

Healthcare organizations in the United States must adhere to the guidance of both the HIPAA (Health Insurance Portability and Accountability Act) and HITECH (Health Information Technology for Economic and Clinical Health Act) for securing and protec…
Invest in your employees with these five simple steps to improve employee engagement and retention.
An overview on how to enroll an hourly employee into the employee database and how to give them access into the clock in terminal.
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

751 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