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-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 1143 views
  • 3 likes
  • 3 in conversation