BookmarkSubscribeRSS Feed
sulaiman1760
Calcite | Level 5

Hi everyone, 

I am new in SAS and I am currently working on my first assignment.

I have a PISA data set, where I have to find all the schools that have a reading score above 500.

 

Now, I do have a variable for school 'schoolid' and a variable for reading score 'score_r'.

I thought about making an if-statement that returns the value in schoolid, whenever they fulfilled score_r>500, but do you know how I can write this in SAS the proper way?

 

best regards

Sulaiman.

 

4 REPLIES 4
PaigeMiller
Diamond | Level 26
if score_r>500 then ... ;

It's not really clear to me what you want to have happen when score_r>500, so that part requires more explanation. The value of school_id is already in the variable school_id, so you don't really need to do anything, or maybe I'm just not understanding what you are asking.

--
Paige Miller
sulaiman1760
Calcite | Level 5
We have data for couple schools lets say:
school1 school2 ...
they all have a different reading score, so maybe school1 has reading score of 501, that would be score_r=501 and school2 has score_r=499.
In this task I need to make a code that only returns school1, because that is the only one with score_r>500. Excuse me, if the question was unclear.
PaigeMiller
Diamond | Level 26

In this task I need to make a code that only returns school1, because that is the only one with score_r>500

So you want to eliminate the school with score_r<=500 from the data set?

 

data want;
    set have;
    if score_r>500;
run;
--
Paige Miller

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 4 replies
  • 866 views
  • 1 like
  • 2 in conversation