You have the syntax wrong. I imagined variable V1.  I have no idea is
this accomplishes what you want, it just corrects the syntax to
illustrate how you have the syntax wrong. The spacing before the
RECODE/COMPUTE statements is just to make it easier to read.

DO IF(P5=2 or P6=2 or P7=2).
   RECODE V1 (2=1) INTO Var0001.
ELSE IF (P8=1).
  RECODE P8 (1=2) into Var0001.
ELSE.
   COMPUTE Var0001=3
EXECUTE.

Also, I don't think you need to use RECODE:

DO IF(P5=2 or P6=2 or P7=2).
   COMPUTE Var0001 = 1.
ELSE IF (P8=1).
   COMPUTE Var0001 = 2.
ELSE.
   COMPUTE Var0001 = 3
EXECUTE.

On 10/27/2017 11:45 AM, Betsabé Cohen wrote:
> Hi Alan: 
> I wrote it like this and still result error: 
> DO IF(P5=2 or P6=2 or P7=2) RECODE (2=1) INTO Var0001
> ELSE IF (P8=1) 
> RECODE P8 
> (1=2) 
> ELSE COMPUTE 3
> EXECUTE.
>
>
> *
> *
> *LIC. BETSABE LAILA COHEN*
> betsabe.co...@gmail.com  <mailto:betsabe.co...@gmail.com>
> CEL: +54911 5701 3993
>
>
>
> 2017-10-23 17:45 GMT-03:00 Alan Mead <am...@alanmead.org
> <mailto:am...@alanmead.org>>:
>
>     Let's assume you have variables X1, x2, x3, etc. and you wish to
>     create a new variable cond with values like 1, 2, 3, etc. then do
>     one of these:
>
>     if( x1 = 1 or x2 = 3) cond = 1.
>     if( (x2 = 1 and x4=1) or x3 = 1) cond = 2.
>     etc....
>     execute.
>
>     OR, do this:
>
>     do if( x1 = 1 or x2 = 3).
>       compute cond = 1.
>     else if( (x2 = 1 and x4=1) or x3 = 1).
>       compute cond = 2.
>     else.
>       compute cond = -1.
>     end if.
>     execute.
>
>     The main difference is that the second method assures that cond is
>     assigned something. But unassigned values will be system missing,
>     so maybe that's better.
>
>     If you had a single variable that you wanted to create a new
>     variable with grouped values, then RECODE would be easier but
>     AFAIK it only works on values from a single variable.
>
>     -Alan
>
>
>
>
>     On 10/23/2017 3:37 PM, Betsabé Cohen wrote:
>>     Hi john and Alan 
>>     I’d like to create a new variable where, given certain codes in
>>     certain variables you get other codes in the new variable: if
>>     respondent answer code 1 un variables 5,6 or 7 so in the new
>>     variable it should be code 1, if respondent gets code 1 in
>>     variable 8 it should be code 2 in the new variable but if
>>     respondent gets code 2 it should be code 3 in the new variable.
>>     I wonder sintaxis should be condtional if do, but i dont know...
>>
>>     El El lun, 23 oct. 2017 a las 14:03, Alan Mead
>>     <am...@alanmead.org <mailto:am...@alanmead.org>> escribió:
>>
>>         And if John's explanation is insufficient, please explain
>>         what you are trying to do. A recode statement (if your
>>         conditions depend on values of one variable) or compute
>>         statements in IF or DO IF blocks (otherwise) may be necessary
>>         to accomplish what you want.
>>
>>         -Alan
>>
>>
>>         On 10/23/2017 12:00 PM, John Darrington wrote:
>>>         In PSPP, the simplest way to create a new variable, and assign 
>>> values
>>>         to it derived from existing variables is using the COMPUTE command.
>>>         For example if you have existing variables v1, v2 and v3, you could
>>>         create a new variable as follows:
>>>
>>>         compute newVar = v1 or v2 or v3.
>>>
>>>         (don't forget the . at the end)
>>>
>>>         J'
>>>
>>>         On Mon, Oct 23, 2017 at 01:12:03PM -0300, Betsab?? Cohen wrote:
>>>              Hi everyone:
>>>              I'm a recent user of PSPP and i'm trying to create a new 
>>> variable from
>>>              three other variables using a conditional. In Excel i would 
>>> use IF and OR
>>>              functions but i don't know what should i used in pspp sintaxys:
>>>              
>>>              The idea is to create a new variable as follows:
>>>              
>>>              
>>>              NEW Variable "Condicion_Actividad"
>>>              Existing variables
>>>              Cod.1= Var5=1 or Var6=1 or Var7=1
>>>              Cod.2= Var8=1
>>>              Cod.3= Var8=2
>>>              
>>>              Thanks in advance.
>>>              
>>>              Betsy
>>>              
>>>              
>>>
>>>
>>>         _______________________________________________
>>>         Pspp-users mailing list
>>>         Pspp-users@gnu.org <mailto:Pspp-users@gnu.org>
>>>         https://lists.gnu.org/mailman/listinfo/pspp-users
>>>         <https://lists.gnu.org/mailman/listinfo/pspp-users>
>>
>>         -- 
>>
>>         Alan D. Mead, Ph.D.
>>         President, Talent Algorithms Inc.
>>
>>         science + technology = better workers
>>
>>         http://www.alanmead.org
>>
>>         I've... seen things you people wouldn't believe...
>>         functions on fire in a copy of Orion.
>>         I watched C-Sharp glitter in the dark near a programmable gate.
>>         All those moments will be lost in time, like Ruby... on... Rails... 
>> Time for Pi.
>>
>>                   --"The Register" user Alister, applying the famous 
>>                     "Blade Runner" speech to software development
>>
>>     -- 
>>     *
>>     *
>>     *LIC. BETSABE LAILA COHEN*
>>     betsabe.co...@gmail.com  <mailto:betsabe.co...@gmail.com>
>>     CEL: +54911 5701 3993
>>
>>
>
>     -- 
>
>     Alan D. Mead, Ph.D.
>     President, Talent Algorithms Inc.
>
>     science + technology = better workers
>
>     http://www.alanmead.org
>
>     I've... seen things you people wouldn't believe...
>     functions on fire in a copy of Orion.
>     I watched C-Sharp glitter in the dark near a programmable gate.
>     All those moments will be lost in time, like Ruby... on... Rails... Time 
> for Pi.
>
>               --"The Register" user Alister, applying the famous 
>                 "Blade Runner" speech to software development
>
>

-- 

Alan D. Mead, Ph.D.
President, Talent Algorithms Inc.

science + technology = better workers

http://www.alanmead.org

I've... seen things you people wouldn't believe...
functions on fire in a copy of Orion.
I watched C-Sharp glitter in the dark near a programmable gate.
All those moments will be lost in time, like Ruby... on... Rails... Time for Pi.

          --"The Register" user Alister, applying the famous 
            "Blade Runner" speech to software development

_______________________________________________
Pspp-users mailing list
Pspp-users@gnu.org
https://lists.gnu.org/mailman/listinfo/pspp-users

Reply via email to