## Newbie Question: Creating Dummy Variables (syntax code)

### Newbie Question: Creating Dummy Variables (syntax code)

Hello!

I want to create dummy variables for the residuals of a regression.
How can I do this? With the simple If command I only get
(example)

0
0
1
0
0
1
0

But I want something like
0 0
0 0
1 0
0 0
0 0
0 1
0 0

Thanks!

### Newbie Question: Creating Dummy Variables (syntax code)

Quote:>Hello!

>I want to create dummy variables for the residuals of a regression.
>How can I do this? With the simple If command I only get
>(example)

>0
>0
>1
>0
>0
>1
>0

>But I want something like
>0 0
>0 0
>1 0
>0 0
>0 0
>0 1
>0 0

>Thanks!

This what I could find on google when I had a similar difficulty:
http://online.mq.edu.au/pub/PSYSTAT/mansynt2.pdf
Asuming u have 'group' with 4 (3+ 1 reference) levels then dummies for
first 3 levels:

do if (group eq 1).
compute grp1=1.
else.
compute grp1=0.
end if.
do if (group eq 2).
compute grp2=1.
else.
compute grp2=0.
end if.
do if (group eq 3).
compute grp3=1.
else.
compute grp3=0.
end if.

I hope that helps.
Cheers,
Shuaib Kauchali

### Newbie Question: Creating Dummy Variables (syntax code)

On Thu, 26 Jun 2003 07:24:49 -0400, Shuaib Kauchali

[snip, question of how to form dummy variables ]

Quote:

> This what I could find on google when I had a similar difficulty:
> http://online.mq.edu.au/pub/PSYSTAT/mansynt2.pdf
> Asuming u have 'group' with 4 (3+ 1 reference) levels then dummies for
> first 3 levels:

> do if (group eq 1).
> compute grp1=1.
> else.
> compute grp1=0.
> end if.
> do if (group eq 2).
> compute grp2=1.
> else.

[snip, rest ]

comment compact syntax (something like this)  when group is large.
Numeric grp(3) .
recode  grp1 to grp3(else=0)    /* initialize .
if      (group le 0) group=4    /* assuming 4 is miscellaneous answer.
if      (group le 4) grp(group)= 1      /* assign 1 for legal range .

--

http://www.pitt.edu/~wpilib/index.html
"Taxes are the price we pay for civilization."  Justice Holmes.

### Newbie Question: Creating Dummy Variables (syntax code)

> Hello!

> I want to create dummy variables for the residuals of a regression.
> How can I do this?
> Thanks!

kind of off topic but
categorizing is so frequently used you might like to install your
"categorizing" code into your menu system using sax basic.  The main
sax command to get you started is  "sntx" (to run your categorizing
syntax).  If you don't know how to create visual basic listboxes to
select the variable to categorize then you can do simple "InputBox\$"s
to automate..

I have this as a menu option and it feels like a built-in SPSS
feature, I think they should look into doing something similar..
Though there are strong reasons not to categorize, I think it is
useful in running tests on data.

can anyone explain me how to create dummy variables for multiple regression
in SPSS. Also, if i have a column with non-numerical data, how can i change
them into 0 and 1s? thanks, James

Sent via Deja.com http://www.deja.com/
Before you buy.