Programming the statistical procedures from SAS

Where=(b1)

Reply
Occasional Contributor
Posts: 5

Where=(b1)


Hello,

I'm working through some code in an old program written by someone else, and I came across the following lines:

Proc Reg ... (where=(b1))...

and

Proc Syslin ... (where=(b3))...

I've searched the documentation and don't see any explanation regarding "where" statements in Proc Reg or Syslin or what b1 and b3 are (they are not variables in the models).  Can anybody help me understand what "where=(b1)" or "where=(b3)" mean?

Thanks.

Super User
Posts: 18,563

Re: Where=(b1)

Where statements are related to the input data set.

Its the equivalent of saying:

where b1 ne 0 or b1 ne .

or where b3 ne 0 or b1 ne .

Super User
Posts: 10,863

Re: Where=(b1)

You didn't post a whole line of code but I will bet that the (where= (b1)) immediately followed the input dataset name. This is one of many dataset options that are universal that allow selecting data, variables and renaming variables at time of execution.

Super Contributor
Posts: 282

Re: Where=(b1)

Hi,

Some documentation on "where=(...)" data set option:

SAS(R) 9.4 Data Set Options: Reference

In your example if b1 is numeric it should either be:

a) "." (missing)

b) "0" (zero)

c) Any other number (e.g. 12, -77, etc.)

(a) & (b) would be equivalent to False (observation would not be used) and (c) would be equivalent of True (observation will be used).

E.g. the second data step uses "where=(age)" to only process a valid age value:

data test1;

  set sashelp.class;

  if name=:'J' then

    age=.;

run;

data test2;

  set test1(where=(age));

run;

Regards,

Amir.

Ask a Question
Discussion stats
  • 3 replies
  • 212 views
  • 0 likes
  • 4 in conversation