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

Hi guys, I am required to produce output like the image sample from the fitness data set. May I know the solutions? The questions is like: What is the highest runtime for male and female individuals in the fitness data file? 123.pngUntitled.png

1 ACCEPTED SOLUTION

Accepted Solutions
kiranv_
Rhodochrosite | Level 12

something like this

 title  'max runtime for female';
 proc sql;
 select max(runtime) as mxdata from sashelp.class
 where sex= 'F';
title;
 title  'max runtime for Male'; 
select max(runtime) as mxdata from sashelp.class
 where sex= 'M';
 quit;

View solution in original post

5 REPLIES 5
kiranv_
Rhodochrosite | Level 12

something like this

 title  'max runtime for female';
 proc sql;
 select max(runtime) as mxdata from sashelp.class
 where sex= 'F';
title;
 title  'max runtime for Male'; 
select max(runtime) as mxdata from sashelp.class
 where sex= 'M';
 quit;
pailek1996
Fluorite | Level 6

May i know, how can i get the "Obs" as the image shown.

kiranv_
Rhodochrosite | Level 12

proc sql number;

select max(runtime) as mxdata from sashelp.class

where sex= 'F';

title;

title 'max runtime for Male';

select max(runtime) as mxdata from sashelp.class

where sex= 'M';

quit;

 

but this shows up as ROW instead of obs as heading or use SAS undocumented function monotonic() as shown below

 

proc sql ;

select monotonic() as Obs, max(runtime) as mxdata from sashelp.class

where sex= 'F';

title;

title 'max runtime for Male';

select monotonic() as Obs, max(runtime) as mxdata from sashelp.class

where sex= 'M';

quit;

pailek1996
Fluorite | Level 6
Thanks so much! This the solution I am looking for, much appreciated!
Jagadishkatam
Amethyst | Level 16

alternatively try the proc means

 

proc means data=have nway;
class sex;
var runtime;
output out=want max=max;
run;
Thanks,
Jag

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

Register now

How to choose a machine learning algorithm

Use this tutorial as a handy guide to weigh the pros and cons of these commonly used machine learning algorithms.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 5 replies
  • 2479 views
  • 3 likes
  • 3 in conversation