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

I am not sure I am doing this correctly, but I have a very large dataset, 10 MILLION ROWS that I am trying to obtain the largest amount in the group. Here is an example of my data have and data need and the code, which I get an error:

DATA HAVE
IDSERVICENETPDAMT
1119000$10.00
1119001$5.00
1111010$15.00
1111049$50.00
2224000$2.00
2225000$5.00
2227000$15.00
2228001$10.00
DATA NEED
IDSERVICENETPDAMT
1111049$50.00
2227000$15.00

DATA NEED;

DATA HAVE;

large1=largest(1,of netpdamt);

by id service;

run;

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

Functions in SAS work across rows, not down a column, so you'll need to use a Proc, such as means/summary or proc sql.

ie

proc means data=have noprint;

class id;

var netpdamt;

output out=want max(netpdamt)=largest;

ID service;

run;

View solution in original post

2 REPLIES 2
Reeza
Super User

Functions in SAS work across rows, not down a column, so you'll need to use a Proc, such as means/summary or proc sql.

ie

proc means data=have noprint;

class id;

var netpdamt;

output out=want max(netpdamt)=largest;

ID service;

run;

ballardw
Super User

This might work.

proc summary data=have nway;

     class Id ;

     var netpdamt;

     output out=want (drop=_type_ _freq_) max= maxid(netpdamt(service))=ServiceMaxAmount;

run;

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!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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