BookmarkSubscribeRSS Feed
DavidPhillips2
Rhodochrosite | Level 12

select sum(hs_GPA)/sum(enrolled) from mytalbe

where ADMISSIONS_POPULATION = 'Enrolled' and enrolled >0 and hs_gpa is not null;

 

The closest thing I have is

case when (<<Measures.HS_GPASUM_for Calc>> is null) then null else sum(<<Measures.HS_GPASUM_for Calc>>)/suM(<<Measures.ENROLLEDSUM>>) end

 

Then I set a filter on where enrolled.

However, the result comes out to .2 rather than an expected GPA.  Its records with null GPA are still being calculated.

5 REPLIES 5
Reeza
Super User

I'm confused, what are you trying to convert to an expression?

 

DavidPhillips2
Rhodochrosite | Level 12

select sum(hs_GPA)/sum(enrolled) from mytable

where ADMISSIONS_POPULATION = 'Enrolled' and enrolled >0 and hs_gpa is not null;

Reeza
Super User

Ok, but why convert, why not leave as is?

This may be an alternative:

 

sum(hs_GPA*(admissions_population='Enrolled' and enrolled>0 and hs_gpa is not null))/sum(enrolled*(admissions_population='Enrolled' and enrolled>0 and hs_gpa is not null)) 
DavidPhillips2
Rhodochrosite | Level 12

I'm confused.  If I need to access the dimension in Web Report Studio don't I need to convert it to an expression to use a custom data item?

Reeza
Super User

My bad. Missed the WRS portion. I have no idea about it. 

 

 

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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.

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
  • 5 replies
  • 802 views
  • 0 likes
  • 2 in conversation