- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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 -
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi, it's ok. I have got it working
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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 -
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
What does your OUT=Myoutfile data set look like with regards to that year variable?
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
@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
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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.
Paige Miller