BookmarkSubscribeRSS Feed
emaguin
Quartz | Level 8

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?

 

 

 

 

 

 

 

 

4 REPLIES 4
Reeza
Super User
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?

 

 

 

 

 

 

 

 


 

emaguin
Quartz | Level 8

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.

 

Reeza
Super User
There are two outputs are generated, minmax1 and minmax2. You'll notice that the layout of the files are very different.

NWAY is documented under the PROC MEAN statement as it's an option to control the output. https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/proc/n1qnc9bddfvhzqn105kqitnf29cp.htm#n10z5tf...

This example illustrates what STACKODS does:
https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/proc/p17h6q7ygvkl1sn13qzf947dundi.htm
Tom
Super User Tom
Super User

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.

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

What is ANOVA?

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.

Discussion stats
  • 4 replies
  • 887 views
  • 0 likes
  • 3 in conversation