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

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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.

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