Solved

Creating Variables in SPSS 12.0

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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

I previously wrote an article addressing the use of UBCD4WIN and SARDU. All are great, but I have always been an advocate of SARDU. Recently it was suggested that I go back and take a look at Easy2Boot in comparison.
In our personal lives, we have well-designed consumer apps to delight us and make even the most complex transactions simple. Many enterprise applications, however, are a bit behind the times. For an enterprise app to be successful in today's tech wo…
This video shows how use content aware, what it’s used for, and when to use it over other tools.
The viewer will learn how to successfully download and install the SARDU utility on Windows 8, without downloading adware.

820 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