Say I have a sample of 100 people, and have their annual income in last 20 years.
It is OK to calculate the average annual income.
NOW I like to calculate the "skewed" average income by year. 1) to skew to the high-income side 2) to skew to the low-income side.
How to put "meaningful" weights on samples? "meaningful" just need a) skew to the desired side and b) sum to 100%.
What rules do you have for "skewwing" the weights? As in how much?
Lots of ways to do this, many may not make sense.
Example dummy code:
Proc sort data=have; by income; run; data reweight; set have nobs=sampsize; weight = _n_ / sampsize; run;
Will assign a smaller weight to the smaller incomes and the largest will have a weight of 1.
Then use Proc Means/Summary or just about any analysis procedure that supports uses of weight variables.
So do you have any rule(s) about how much you want to skew these values?
This makes sense.
In term of how much, that is up to play to find the opt.
Better off without sorting/indexing/averaging.
In that case, how to do if the values can be negative or positive, say a normal t-distribution randoms, the average is non-zero and unknow.
Need skew to left(low-end), without sorting/indexing, how to put weight(just on the value itself) ?!
Not seeing much in the way of any rules to use. How much to skew>
Which values have to be negative or positive? The input or the output?
Some information you may want peruse:
https://support.sas.com/resources/papers/proceedings16/7660-2016.pdf
https://blogs.sas.com/content/iml/2022/09/21/noncentral-t.html
https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Skew-Normal-Distributions/td-p/145628
BTW setting restriction of not sorting or averaging data is may quite well be impractical to impossible depending on a specific task.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.