BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
rapt1
Obsidian | Level 7

Hi guys, 

 

My data tables has about 1,000 records with the following variables:

Name

Age

City

State

MonthlyBill

 

I am using the following code to remove retain those who are from NY and pays monthly of $500 or less

 

proc sql;
create table want as
select t1.*
from have t1
where t1.state IN ('NY') 
and t1.MonthlyBill lt 500;
quit;

I am left with 300 records and I am confused. Upon checking, my tables have about 200 NY customers and 500 are those below 500 bill. I was only expecting about 200 to be removed.

 

Any thoughts?

 

1 ACCEPTED SOLUTION

Accepted Solutions
Tom
Super User Tom
Super User

Your description is confusing.  Your code is not "removing" anything. It is selecting just the observations that meet both criteria.

So if there are only 200 NY records then the maximum number of observations you will get is 200.  If any of them have bills larger than 500 then you will get less than 200.  Remember that SAS will treat missing values as less than any actual number so your WANT dataset could include observations with missing values for monthlybill

 

View solution in original post

2 REPLIES 2
Tom
Super User Tom
Super User

Your description is confusing.  Your code is not "removing" anything. It is selecting just the observations that meet both criteria.

So if there are only 200 NY records then the maximum number of observations you will get is 200.  If any of them have bills larger than 500 then you will get less than 200.  Remember that SAS will treat missing values as less than any actual number so your WANT dataset could include observations with missing values for monthlybill

 

rapt1
Obsidian | Level 7

Oh. Let me revisit my code. Thanks!

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 673 views
  • 1 like
  • 2 in conversation