BookmarkSubscribeRSS Feed
lmyers2
Obsidian | Level 7

Hello,

 

I'm using SAS 9.4 full version. Is there a place in the following proc logist coding to put a where statement?  I'd like to run this regression only when a binary variable CASE='1'.  

 

Thanks

Laura

 

proc logist descending; 

class VARIABLE1 VARIABLE2 VARIABLE3; 

model Payment=VARIABLE1 VARIABLE2 VARIABLE3 VARIABLE4 / rsquare; 

run;
3 REPLIES 3
WarrenKuhfeld
Rhodochrosite | Level 12

proc logistic?

 

You can specify a WHERE statement most anywhere;

 

proc ...;

where case eq '1';

... more statements ...

run;

 

I usually use the data set option.

 

proc logistic data=sashelp.class(where=(age le 15));
  class sex;
  model sex = height weight;
run;

 

ballardw
Super User

Did you try

proc logist descending; 
   where case='1';
   class VARIABLE1 VARIABLE2 VARIABLE3; 
   model Payment=VARIABLE1 VARIABLE2 VARIABLE3 VARIABLE4 / rsquare; 

run;

It is a very good habit to always use the data= on the proc statement.

 

If you are working with multiple data sets with the same variables as in the modeling code there is a chance that you might just accidentally run this against the wrong data set if you run blocks of code manually.

 

Any chance that should be LOGISTIC?

if that doesn't work then this should

proc logist descending data=_last_(where= ( case='1') ); 
Reeza
Super User

 @lmyers2 Make sure to look up how CLASS variables are handled, the default encoding is GLM which is unlikely what you want. 

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 2027 views
  • 2 likes
  • 4 in conversation