Is there a report listing when using the RECODE statement?

Discussions about editing and cleaning data
Post Reply
pierrew
Posts: 47
Joined: August 8th, 2012, 5:20 am
Location: Pohnpei, Federated States of Micronesia

Is there a report listing when using the RECODE statement?

Post 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
pierrew
Posts: 47
Joined: August 8th, 2012, 5:20 am
Location: Pohnpei, Federated States of Micronesia

Re: Is there a report listing when using the RECODE statemen

Post 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;

Gregory Martin
Posts: 1792
Joined: December 5th, 2011, 11:27 pm
Location: Washington, DC

Re: Is there a report listing when using the RECODE statemen

Post 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.
pierrew
Posts: 47
Joined: August 8th, 2012, 5:20 am
Location: Pohnpei, Federated States of Micronesia

Re: Is there a report listing when using the RECODE statemen

Post by pierrew »

Thanks Greg,
I haven't thought about using a function to track data item changes. Excellent.

peace-
Post Reply