BookmarkSubscribeRSS Feed
Jabbawonga
Calcite | Level 5


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.

3 REPLIES 3
Reeza
Super User

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 .

ballardw
Super User

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.

Amir
PROC Star

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.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 3 replies
  • 1441 views
  • 0 likes
  • 4 in conversation