|
Dear all,
I am having trouble with a DO IF command. It gives me an error message that it is not recognized and that I should use level of control etc. I don't know where this level of control is, and it's odd that a simple statement that used to work no longer does: namely, DO IF tempcode.1=102. COMPUTE uinccode=15. END IF. EXECUTE. Instead, every uinccode becomes 15 (without the subsetting). Thanks so much, Bogdan Bogdan Tereshchenko Research Assistant Justice Policy Center The Urban Institute 2100 M Street, NW, Suite 700 Washington, DC 20037 Tel. (202) 261-5803 Fax (202) 296-2252 |
|
remove the dot in tempcode and replace with _
see if it works -----Original Message----- From: SPSSX(r) Discussion on behalf of Tereshchenko, Bogdan Sent: Wed 6/20/2007 10:42 PM To: [hidden email] Cc: Subject: DO IF problem Dear all, I am having trouble with a DO IF command. It gives me an error message that it is not recognized and that I should use level of control etc. I don't know where this level of control is, and it's odd that a simple statement that used to work no longer does: namely, DO IF tempcode.1=102. COMPUTE uinccode=15. END IF. EXECUTE. Instead, every uinccode becomes 15 (without the subsetting). Thanks so much, Bogdan Bogdan Tereshchenko Research Assistant Justice Policy Center The Urban Institute 2100 M Street, NW, Suite 700 Washington, DC 20037 Tel. (202) 261-5803 Fax (202) 296-2252 |
|
Can also be written as :
IF (tempcode_1=102) uinccode=15 . -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]]On Behalf Of Manmit Shrimali Sent: Wednesday, June 20, 2007 1:24 PM To: [hidden email] Subject: Re: DO IF problem remove the dot in tempcode and replace with _ see if it works -----Original Message----- From: SPSSX(r) Discussion on behalf of Tereshchenko, Bogdan Sent: Wed 6/20/2007 10:42 PM To: [hidden email] Cc: Subject: DO IF problem Dear all, I am having trouble with a DO IF command. It gives me an error message that it is not recognized and that I should use level of control etc. I don't know where this level of control is, and it's odd that a simple statement that used to work no longer does: namely, DO IF tempcode.1=102. COMPUTE uinccode=15. END IF. EXECUTE. Instead, every uinccode becomes 15 (without the subsetting). Thanks so much, Bogdan Bogdan Tereshchenko Research Assistant Justice Policy Center The Urban Institute 2100 M Street, NW, Suite 700 Washington, DC 20037 Tel. (202) 261-5803 Fax (202) 296-2252 |
|
In reply to this post by Tereshchenko, Bogdan
At 01:12 PM 6/20/2007, Tereshchenko, Bogdan wrote:
>A DO IF command gives me an error message that it is not recognized >and that I should use level of control etc. I don't know where this >level of control is (Wryly) That's because SPSS does refer to a level of control indicator in the margins, but it hasn't seemed to exist for a long time. >It's odd that a simple statement that used to work no longer does: > >DO IF tempcode.1=102. > >COMPUTE uinccode=15. > >END IF. > >Instead, every uinccode becomes 15 (without the subsetting). You've heard "remove the dot in tempcode and replace with _". That's likely not the right advice. At least, 'tempcode.1' is a valid variable name(*). If it's the one you want, using another name won't help. However, make sure that 'tempcode.1' exists and is numeric. If either is not true, you'll get pretty much what you're seeing. It that doesn't solve it, could you post the listing, with the syntax and the exact error message? With 'tempcode.1' numeric in the file, the *exact* code you posted works for me (SPSS 15 draft output; WRR:not saved separately): DATA LIST FREE /tempcode.1. BEGIN DATA 100 101 102 103 104. END DATA. DO IF tempcode.1=102. COMPUTE uinccode=15. END IF. LIST. List |-----------------------------|---------------------------| |Output Created |20-JUN-2007 15:38:03 | |-----------------------------|---------------------------| tempcode.1 uinccode 100.00 . 101.00 . 102.00 15.00 103.00 . 104.00 . Number of cases read: 5 Number of cases listed: 5 .................... (*) SPSS 15 Command Syntax Reference p.31: >Variable names can be up to 64 bytes long, and the first character >must be a letter or one of the characters @, #, or $. Subsequent >characters can be any combination of letters, numbers, a period (.), >and nonpunctuation characters. Names of the form 'tempcode.1' are frequently created by CASESTOVARS. |
|
Thank you all.
I used the advice from Manmit just in case. But Richard is right: the problem was that a prior comment statement ended in ." (using proper English syntax) rather than .". using SPSS-intelligible comment syntax. I changed all comments accordingly which seemed to take care of the problem. Thanks so much! -----Original Message----- From: Richard Ristow [mailto:[hidden email]] Sent: Wednesday, June 20, 2007 3:42 PM To: Tereshchenko, Bogdan; [hidden email] Cc: Manmit Shrimali; Edward Boadi Subject: Re: DO IF problem At 01:12 PM 6/20/2007, Tereshchenko, Bogdan wrote: >A DO IF command gives me an error message that it is not recognized and >that I should use level of control etc. I don't know where this level >of control is (Wryly) That's because SPSS does refer to a level of control indicator in the margins, but it hasn't seemed to exist for a long time. >It's odd that a simple statement that used to work no longer does: > >DO IF tempcode.1=102. > >COMPUTE uinccode=15. > >END IF. > >Instead, every uinccode becomes 15 (without the subsetting). You've heard "remove the dot in tempcode and replace with _". That's likely not the right advice. At least, 'tempcode.1' is a valid variable name(*). If it's the one you want, using another name won't help. However, make sure that 'tempcode.1' exists and is numeric. If either is not true, you'll get pretty much what you're seeing. It that doesn't solve it, could you post the listing, with the syntax and the exact error message? With 'tempcode.1' numeric in the file, the *exact* code you posted works for me (SPSS 15 draft output; WRR:not saved separately): DATA LIST FREE /tempcode.1. BEGIN DATA 100 101 102 103 104. END DATA. DO IF tempcode.1=102. COMPUTE uinccode=15. END IF. LIST. List |-----------------------------|---------------------------| |Output Created |20-JUN-2007 15:38:03 | |-----------------------------|---------------------------| tempcode.1 uinccode 100.00 . 101.00 . 102.00 15.00 103.00 . 104.00 . Number of cases read: 5 Number of cases listed: 5 .................... (*) SPSS 15 Command Syntax Reference p.31: >Variable names can be up to 64 bytes long, and the first character must >be a letter or one of the characters @, #, or $. Subsequent characters >can be any combination of letters, numbers, a period (.), and >nonpunctuation characters. Names of the form 'tempcode.1' are frequently created by CASESTOVARS. |
| Free forum by Nabble | Edit this page |
