BookmarkSubscribeRSS Feed
lp750sv
Calcite | Level 5

hi every one, this is the first time I learned about SAS, I am using proc logistic to compare the odds of an outcome between people who are 70 years old and who are 15 years older than them, how should I write down the code to locate the population who are 70 years old? 

here is my code

proc logistic data= lungcancer desc;
model casecont= age/clodds=wald; where age =70;
units age=15;
run;

 

it works, but it does not give a odds ratio and includes all the observations, i know this is wrong, please help me out, please

3 REPLIES 3
ballardw
Super User

Where statements filter the records. So the data only had age=70. So there was no other value to compare or create odds ratio from.

If want to use exactly two values of age then you could filter to those using:

where age in (70 85);

Typically the way many of the regression procedures work the "set up" information about variables needs to be defined before the Model statement. So try the WHERE before the MODEL. If that still "uses all the observations" then include the LOG in another post. Copy the text from the log. Then on the forum open a text box using  the </> icon that appears above the message window and then paste in the box.

The text will preserve text formatting of any Log diagnostics. The main message windows will reformat text pasted so anything that may be sensitive to position really should be pasted into a text box. You can see what the text box looks like above.

It is a good idea to post code that way as well. One it sets the code apart from general question text and second, if you use any indents to structure code, the text box preserves such.

 

tom_grant
SAS Super FREQ
Can you provide some more details about your data (lungcancer), specifically the variable casecount - Is the lungcancer data already summarized or is each row an individual person?? (i.e - when you apply your where statement (where age in (70 85), will you be left with two rows from lungcancer data or many rows with individuals).

Another question, is the lungcancer data in the Work library as your code suggests??
lp750sv
Calcite | Level 5
thanks for you all's responses, so I run the code again using where age in (70 85) this time, there is no errror, but there are two warnings showed up in sas, it said there is possibly a quasi-complete separation of data points. the maximum likelihood estimate may not exist. the logistic procedure continues in spite of the above warning. results shown are based on the last maximum likelihood

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

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
  • 382 views
  • 0 likes
  • 3 in conversation