I'm checking data and i want to look at min and max values for a set of variables. The dataset consists of an id variable, burstday, a person id, studyid, and the set of variables. Each person id will appear burstday times, so a long format repeated measures structure. I understand how to do the basic analysis.
proc means data=stack noprint n min max maxdec=0; class burstday; var Dalc1 Dalc2; run;
I want to run the output to a datafile.I began with this:
proc means data=stack noprint n min max maxdec=0; class burstday;
var Dalc1 Dalc2; output out=minmax n=valn min=minval max=maxval; run;
I get the n, min, and max for each value of burstday (plus what may be the total sample value and which i don't care about) for an unidentified variable but not both named variables.
Q1: what do i do to get the summary stats for both, i.e., all named, variables?
ods select none;
proc means data=stack n min max maxdec=0 NWAY STACKODS;
class burstday;
var Dalc1 Dalc2;
output out=minmax1 n= min= max= / autoname;
ods output summary = minmax2;
run;
ods select all;
Two methods above.
Look into NWAY and STACKODS options or here's some instructions and explanations on how to capture output that is shown.
https://blogs.sas.com/content/sastraining/2017/03/31/capturing-output-from-any-procedure-with-an-ods...
@emaguin wrote:
I'm checking data and i want to look at min and max values for a set of variables. The dataset consists of an id variable, burstday, a person id, studyid, and the set of variables. Each person id will appear burstday times, so a long format repeated measures structure. I understand how to do the basic analysis.
proc means data=stack noprint n min max maxdec=0; class burstday; var Dalc1 Dalc2; run;
I want to run the output to a datafile.I began with this:
proc means data=stack noprint n min max maxdec=0; class burstday;
var Dalc1 Dalc2; output out=minmax n=valn min=minval max=maxval; run;I get the n, min, and max for each value of burstday (plus what may be the total sample value and which i don't care about) for an unidentified variable but not both named variables.
Q1: what do i do to get the summary stats for both, i.e., all named, variables?
Thank you, Reeza. I don't find "NWAY" in the proc means documentation (i find WAYS) and i don't find it in the documentation at all when i search for it. It looks like STACKODS provides desired data structure. I don't know what the ODS lines are for. I just put them in and ran the sequence and nothing seems different.
You have to give it more names.
proc summary data=stack nway ;
class burstday;
var Dalc1 Dalc2;
output out=minmax n=n1 n2 min=min1 min2 max=max1 max2;
run;
Or let it make up the names by using the autoname option.
output out=minmax n= min= max= / autoname ;
Note: If you aren't making any output just use the alias SUMMARY for the proc. NOPRINT is the default for PROC SUMMARY.
Note: NWAY is an optional keyword on the PROC statement, not a statement of its own like WAYS.
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.
Find more tutorials on the SAS Users YouTube channel.