Hi,
I'm trying to create a new variable that indicates a minimum value and a maximum value of a parameter by subjid.
Basically trying to follow this specification:
Per SUBJID & PARAM:
MAXIMUM = the first record with the largest AVAL
MINIMUM = the first record with the smallest AVAL
For example lets say i have this set of data:
subjid paramcd aval
1 ALT 34
1 ALT 39
1 ALT 28
1 ALT 28
1 ALT 40
1 ALT 40
1 APT 15
1 APT 15
1 APT 15
1 APT 9
1 APT 9
1 APT 15
1 APT 12
1 ABC 9
1 ABC 9
1 ABC 9
1 ABC 9
I want the variable DTYPE to indicate the first max value and the first min value: Also if the aval value is the same i want to put both min and max
subjid paramcd aval dtype
1 ALT 34
1 ALT 39
1 ALT 28 min
1 ALT 28
1 ALT 40 max
1 ALT 40
1 APT 15 max
1 APT 15
1 APT 15
1 APT 9 min
1 APT 9
1 APT 15
1 APT 12
1 ABC 9 min
1 ABC 9 max
1 ABC 9
1 ABC 9
This is the same question you posted in https://communities.sas.com/t5/SAS-Programming/Using-proc-sql-to-create-min-and-max/m-p/645368
You should follow the answers there.
I am starting to believe you are not after Proc SQL only solution anymore as mentioned in your original stated requirement on the other thread, and so you have a lot more options to choose from the original thread. I did see your response to my request there. I appreciate it. Relax and keep the communication in the same thread.
Unfortunately I am caught up with anything and everything to do at work but SAS. It's rather frustrating to miss all the fun here. I will try to get my hands on your requirement soon as I can, unless you already have received one from somebody else.
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!
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.