BookmarkSubscribeRSS Feed
Dregerator
Obsidian | Level 7

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

 

 

2 REPLIES 2
novinosrin
Tourmaline | Level 20

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. 

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 1075 views
  • 2 likes
  • 3 in conversation