BookmarkSubscribeRSS Feed
Ivy
Quartz | Level 8 Ivy
Quartz | Level 8

Hello, 

 

I have a data set like this :

 

id   d1   d2  d3  d4  .......................d100 

 

Each id have mutiple rows, with mutiple values of d1, d2...... 

 

I would like to choose the max(d1), max(d2)....,  for each ID .

 

Is there any quick way to do it without list all of the vairables from d1 to d100 ?

 

Thank you very much,

 

Ivy 

 

 

3 REPLIES 3
Reeza
Super User

Depends on what you want your output to look like. If your variables are sequential you can list them like that.

 

proc means data=havenoprint;
by id; *need to sort by ID first;
var d1-d100;
output out=want max= /autoname;
run;
LinusH
Tourmaline | Level 20

Is it the flu or something, every second question has data with wide data sets.

Transpose it to long, then you can easily calculate/aggregate the data any way you want, and just need to refer to your analysis variable only once in your code.

Data never sleeps
PGStats
Opal | Level 21

Spring migration, from Excel to SAS Man Very Happy

PG

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
  • 3 replies
  • 824 views
  • 10 likes
  • 4 in conversation