Tuesday, 15 February 2011

Compilation vs Execution in SAS -



Compilation vs Execution in SAS -

this question discussed on sas forum, , participants agreed disagree .

the issue simple : sas assign missing value variables @ compile time unless variable shows in sum statement (in case sas assigns value of 0 @ compile time ) . here simple proof

info test; set _all_; var1+1; var2=5; set _all_; run;

log screen

var1=0 var2=. _error_=0 _n_=1 var1=1 var2=5 _error_=0 _n_=1 note: info set work.test has 1 observations , 2 variables.

var2 assigned missing value var1 assigned 0 because part of sum statement (i believe )

my question why ? pretty sure sas assignes missing values variables @ compilation . why create exception variable show in sum statement ? there other exceptions ?

i wouldn't phone call sum statement.

the statement

var1+1;

is equivalent of

retain var1 0; var1 = var1 + 1;

nor 'long' sum statement

var1 = var1 + 1;

nor

var1 = sum(var1, 1);

itself retain behavior nor initialization zero. reply question:

initialization 0 part of retain behavior implicitly requested a + b; syntax variable a.

i can't think of other exceptions.

sas

No comments:

Post a Comment