Dear All,
I require help in putting recode statement correctly. Dependent out variable is string while all independent variables are numeric
My Code are following-
recode
Q1_BLID : Q2_VILLID :Q3_SRNO => Q6_TRAINEE_NAME;
1: 1: 1=>"Ram";
1: 1: 2=>"Shyam";
endrecode;
getting error"ERROR: Invalid variable type near line 3 in Q6_TRAINEE_NAME procedure"
Best Regards.
Neelanjana
recode/box statement help
Re: recode/box statement help
Hi Neelanjana
As alternate, you can use this code.
if q1_blid=1 and q2_villid=1 and q3_srno=1 then Q6_Trainee_Name="Ram"
elseif q1_blid=1 and q2_villid=1 and q3_srno=2 then Q6_Trainee_Name="Shyam";
endif;
Why it does not work with recode, probably our Gregory BOSS, may help us out.
Thanks
manoj
m9jiihmr@gmail.com
As alternate, you can use this code.
if q1_blid=1 and q2_villid=1 and q3_srno=1 then Q6_Trainee_Name="Ram"
elseif q1_blid=1 and q2_villid=1 and q3_srno=2 then Q6_Trainee_Name="Shyam";
endif;
Why it does not work with recode, probably our Gregory BOSS, may help us out.
Thanks
manoj
m9jiihmr@gmail.com
-
- Posts: 1812
- Joined: December 5th, 2011, 11:27 pm
- Location: Washington, DC
Re: recode/box statement help
Neelanjana,
There is an error in the helps when it says that you can assign the output of a recode to an alpha variable. Right now you can only assign the output to a numeric variable. We will fix this so that in the next release, 6.0, you will be able to assign to an alpha variable. As Manoj indicated, you will have to use long form statements to achieve the recode:
There is an error in the helps when it says that you can assign the output of a recode to an alpha variable. Right now you can only assign the output to a numeric variable. We will fix this so that in the next release, 6.0, you will be able to assign to an alpha variable. As Manoj indicated, you will have to use long form statements to achieve the recode:
if Q1_BLID = 1 and Q2_VILLID = 1 and Q3_SRNO = 1 then Q6_TRAINEE_NAME = "Ram";
elseif Q1_BLID = 1 and Q2_VILLID = 1 and Q3_SRNO = 2 then Q6_TRAINEE_NAME = "Shyam";
// elseif ...
endif;
elseif Q1_BLID = 1 and Q2_VILLID = 1 and Q3_SRNO = 2 then Q6_TRAINEE_NAME = "Shyam";
// elseif ...
endif;
Re: recode/box statement help
Thanks to both of you. as we have large database with name and other details many of them are in alpha ,I am using loadcases which is Ok.
Regards.
Neelanjana
Regards.
Neelanjana