Page 1 of 1
Is there a report listing when using the RECODE statement?
Posted: August 4th, 2014, 8:32 pm
by pierrew
I have been using the recode statement and instead of writing a lengthy code to track the number of items that have been recoded and I was wondering if CSPro has a listing file that records the number of recodes just like what is reported when using the impute statement.
Thanks,
Pierre
Re: Is there a report listing when using the RECODE statemen
Posted: August 5th, 2014, 3:03 am
by pierrew
Hey Greg ... can you implement something like this? change two data items on a single recode?
Code: Select all
Format:
recode var-1 [:var-2 [:var-n]] => var-out-1 => var-out-2;
[range-1] [:range-2 [:range-n]] => exp-1 => exp-2;
[range-1] [:range-2 [:range-n]] => exp-1 => exp-2;
: : :
[: [:]] => other-exp-1 => other-exp-2;
endrecode;
Re: Is there a report listing when using the RECODE statemen
Posted: August 14th, 2014, 8:03 pm
by Gregory Martin
There's no listing report generated during the recode. The recode is a pretty dumb function, in that it can't do anything clever like you suggest. Can you just recode the value to a temporary variable and then use the impute function to assign it to the desired variable so that you'll get that error report?
Alternatively, you can use the output of a function as the assignment value, so you could log stuff yourself like this:
function LogRecode(value)
write("Recoding to %d",value);
LogRecode = value;
end;
// ...
recode XXX => YYY;
1-10 => LogRecode(1);
11-99 => LogRecode(2);
endrecode;
The multiple output recode is an interesting idea. I'll add it to the feature request list as something that we could implement.
Re: Is there a report listing when using the RECODE statemen
Posted: August 17th, 2014, 5:50 pm
by pierrew
Thanks Greg,
I haven't thought about using a function to track data item changes. Excellent.
peace-