BookmarkSubscribeRSS Feed
marleeakerson
Calcite | Level 5

I am running a relatively simple piece of code (pasted below): 

 

data
X
Y ;
set have;
if &StartDate <= Birth_Date then output=X;
if &Date20 <= Birth_Date <= &Date12 then output=Y;
run;

 

But when I run it i get this error:

 

NOTE: Variable X is uninitialized.
NOTE: Variable Y is uninitialized.

 

Can anyone explain why this is happening? X and Y are tables i am trying to create, not variables. 

 

Thank you!

1 REPLY 1
Reeza
Super User

The syntax is wrong, the = sign is not required and instead reads as a variable assignment, ie SAS is interpreting this as "add a variable output with the value of X/Y", not use the OUTPUT statement functionality.

 

Remove the = sign.

 

 

data    X     Y ;
set have;
if &StartDate <= Birth_Date then output X;
if &Date20 <= Birth_Date <= &Date12 then output Y;

run;

 

FYI - please post your code in a code block, don't italicize it. The code block helps maintain formatting, legibility and doesn't add extra HTML characters.


@marleeakerson wrote:

I am running a relatively simple piece of code (pasted below): 

 

data
X
Y ;
set have;
if &StartDate <= Birth_Date then output=X;
if &Date20 <= Birth_Date <= &Date12 then output=Y;
run;

 

But when I run it i get this error:

 

NOTE: Variable X is uninitialized.
NOTE: Variable Y is uninitialized.

 

Can anyone explain why this is happening? X and Y are tables i am trying to create, not variables. 

 

Thank you!