Solved

Creating Variables in SPSS 12.0

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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Today, still in the boom of Apple, PC's and products, nearly 50% of the computer users use Windows as graphical operating systems. If you are among those users who love windows, but are grappling to keep the system's hard drive optimized, then you s…
In this article, you will read about the trends across the human resources departments for the upcoming year. Some of them include improving employee experience, adopting new technologies, using HR software to its full extent, and integrating artifi…
Video by: Tony
This video teaches viewers how to export a project from Adobe Premiere Pro and the various file types involved.
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…

623 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