Dear all,
am tring to calculate the mean and standard error of some data set using this code:
proc means data=mydataset;
var myvar
class diagnosisyear sex;
output out= myoutfile mean=meanresult stderr= stderr
run;
when I run this I get a table which looks like this
diagnosisyear sex myvar mean stderr
2011 M 41 10 2
F 33 5 1
2012 M 20 6 1
F 11 2 0.5
2013 M 15 3 1
F 50 11 3
my problem here is that the diagnosis year for the females are not printed. I don't know why this is happening.
In my log I get this message:
Multiple concurrent threads will be used to summarize data
Any help?
hi,
the results are ok, the diagnosis year is not printed for a cleaner view on the results, it's only printed when it changes. F 33 5 1 relates to the diagnosis year 2011.
- Cheers -
Is there any way to still make this to be printed. I will like to use the values to plot a graph. So it will be helpful if these are printed
Hi, it's ok. I have got it working
First if you do not need the summary statistics in myoutfile then run proc means with 'nway' and 'noprint' option.
Then run a proc report on myoutfile to fine tune the display.
proc means data=sashelp.class nway noprint;
var weight;
class sex age;
output out= myoutfile mean=meanresult stderr=standerr;
run;
proc sort data=myoutfile; by age sex;run;
data myoutfile;
set myoutfile;
order+1;
run;
proc report data=myoutfile;
columns order sex age meanresult standerr;
define order / order order=data noprint;
define sex / display;
define age / display;
run;
- Cheers -
That was supposed to be . If you want YEAR, you need another PROC PRINT to print it .
ods output summary=summary; proc means data=sashelp.heart nway stackodsoutput; var height; class status bp_status; output out= myoutfile mean=meanresult stderr= stderr ; run; proc print data=summary label noobs;run;
You appear to already be sending the statistics you want to the dataset named in the OUTPUT statement.
If you don't want the print-out then add NOPRINT the PROC statement.
What does your OUT=Myoutfile data set look like with regards to that year variable?
@ballardw @Tom @Ksharp @Oligolas : Thank you all for the tips.
The myoutfile looks like this
diagnosisyear sex myvar mean stderr
2011 M 41 10 2
F 33 5 1
2012 M 20 6 1
F 11 2 0.5
2013 M 15 3 1
F 50 11 3
but I wanted something like this
diagnosisyear sex myvar mean stderr
2011 M 41 10 2
2011 F 33 5 1
2012 M 20 6 1
2012 F 11 2 0.5
2013 M 15 3 1
2013 F 50 11 3
but it's ok, don't border yourself any longer,
I did some work arouds and could further use the dataset for further analysis
Your output data set will show the data as you want. The HTML output will not.
Example:
proc means data=sashelp.class nway noprint;
class age sex;
var height weight;
output out=_stats_ mean= std=/autoname;
run;
produces this data set named _STATS_
If you really really really want HTML output, then do a PROC PRINT of the above data set.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.