I have the following data with the listed variables for time 1hr. There are similar data sets for times 2,3,4,6,7,8,12,and 24 hrs.
ID AMT Time CMT Y
15 1 0 1 3 0.40953 .
16 2 0 1 3 0.2531 .
17 3 0 1 3 30.549 .
18 4 0 1 3 2.2213 .
19 5 0 1 3 1.829 .
20 6 0 1 3 8.8514 .
21 7 0 1 3 29.094 .
22 8 0 1 3 4.2443 .
23 9 0 1 3 0.68437 .
24 10 0 1 3 3.3793 .
25 11 0 1 3 2.8721 .
26 12 0 1 3 0.7927 .
27 13 0 1 3 7.477 .
28 14 0 1 3 0.98951 .
I have done a box plot and ID's 7 and 3 are outliers. My question is there code that I can use with SAS univariate that will allow me to obtain the Winsorized mean variable Y for each collection time period? I have searched but could not find code modification to do so. I realize this could be done by brute force by analyzing each time separately.
1. Combine them into one data set and identify the source data set as the time.
data combined;
set time.time_hour: indsname=source; *assuming you have a naming convention;
dsin=source;
run;
2. Calculate summary statistics
proc univariate data=combined winsorized=5;
class dsin;
var y;
run;
So you have separate data sets for each time? Then combine the datasets into one, and perform PROC UNIVARIATE with a BY statement.
Copy the code submitted and the messages from the log and paste that into a code box opened using the forum {I} icon.
You do know that exclude all means no output is generated with the example code so your Winmeans data set will not be created.
1. Combine them into one data set and identify the source data set as the time.
data combined;
set time.time_hour: indsname=source; *assuming you have a naming convention;
dsin=source;
run;
2. Calculate summary statistics
proc univariate data=combined winsorized=5;
class dsin;
var y;
run;
This code solved my problem
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.