05-17-2013 11:30 PM
Not completely sure how to use the 'retain' and/or 'sum' statements or if they even apply.
|patient ID||pulse rate||Blood Pressure|
05-18-2013 10:45 AM
Thanks man. I know the proc means with the median option but I wanted help on trying to figure it out
with the use of retain and sum statements in other words through the use of 'brute force'.
I appreciate any help
05-18-2013 03:38 PM
You need to define what's a median to you, specifically if you have even number of observations.
Sum is not required to calculate median, retain/lag may or may not be helpful depending on your methodology.
You do need to sort your data set first, find the number of obs. If odd, take the middle value, you can use point in a data step.
If even then it depends on your method, usually an average, so then two point statements in a datastep would work.
05-18-2013 04:11 PM
I forgot to mention that the median would be for the Blood pressure variable and to be saved in another variable median_1 in excel I'm trying to apply your comments but I'm going nuts.
05-18-2013 05:18 PM
Explain why you can't use proc means or standard procs. Otherwise it sounds like homework, which I don't feel inclined to help with.
05-18-2013 05:42 PM
Competition between coworkers where one claims to be able to find the median without using standard (faster/more comprehensive) methods like proc means, univariate, etc.
05-18-2013 12:04 PM
This is quite simple. Consider the ingredients:
NOBS option to SET statement
_N_ automatic variable
and answer the question : Where do you expect the median value to be in a sorted dataset?