useR
useR

Reputation: 3082

enquiry on do loop mechanism in data step

I am preparing for sas base exam and wonder why the variable prod can still be generated while no initialization of the variable. So for every element will set to 0 by default?

data word;
    do until(prod gt 6);
        prod + 1;
    end;
run;

Upvotes: 0

Views: 48

Answers (1)

Jonas
Jonas

Reputation: 321

This has to do with the + sign. This is a special statement in SAS. It is equivalent of writing: retain prod 0;

More info can be found here: https://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000289454.htm

Good luck!

Upvotes: 4

Related Questions