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
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;
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.
Spring migration, from Excel to SAS ![]()
April 27 – 30 | Gaylord Texan | Grapevine, Texas
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!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.
Ready to level-up your skills? Choose your own adventure.