Page 1 of 1

recode/box statement help

Posted: July 30th, 2014, 4:58 am
by neel_ak47
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

Re: recode/box statement help

Posted: July 30th, 2014, 11:42 pm
by manojsoni
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

Re: recode/box statement help

Posted: July 31st, 2014, 1:57 pm
by Gregory Martin
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:
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;

Re: recode/box statement help

Posted: August 1st, 2014, 6:49 am
by neel_ak47
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