- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
The attrib/label statement will only remove the labels of the input variable but not of the statistics computed with proc means.
Is there any option which could be used to avoid an extra data step/proc datasets?
In the example, the N Obs label is first added on the computed nobs variable, and so on.
ods exclude all;
ods output summary=test;
proc means data=sashelp.class ;
class sex; var height;
*attrib _all_ label=' ';
run;
ods exclude none;
proc print data=test label noobs;
run;
proc datasets lib=work nolist;
modify test;
attrib _all_ label=' ';
run;
quit;
proc print data=test label noobs;
run;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
What is the real objective here? To create a report with no labels or to create a data set with statistics with no labels?
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Well, @xxformat_com , you have been asked several times for explanation about what you will do with this "statistic with no label" once you have it. Please provide the answer.
Paige Miller
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
@xxformat_com wrote:
statistics with no label.
Please be kind and explain why you want this. Should you achieve this "statistics with no label", what would you do with the resulting statistics with no label, that requires no label and would not work properly if there is a label?
I believe that the default label for variables is the variable name.
Paige Miller
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I really don't understand what the issue is. If you don't want to print the labels then don't print the labels.
proc print data=test noobs;
run;
Or just skip using ODS output and instead use the OUTPUT statement to generate a dataset.
That dataset does not add labels.
You can also make a wider dataset.
proc means data=sashelp.class nolabels;
class sex; var height;
output out=stats;
output out=stats_wide n= min= max= mean= std= / autoname ;
run;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
@tomy Actually I was not expecting any difference between ods output statement and the output statement.
I'm really surprise that both label and format are added to output datasets by default without any possibility to avoid them upfront.
I don't see as beneficially to have to go back to old syntax because of that or add additional steps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
It is normally much better to use the datasets that a procedure can generate. They are designed to used as data. The stuff you can capture via ODS is stuff that is designed to be a REPORT.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
options nolabel;
at the top of your code.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
@Ksharp Actually no. Here is an example showing that using the global option is not helping:
options nolabel;
ods exclude all;
ods output summary=test;
proc means data=sashelp.class ;
class sex; var height;
attrib _all_ label=' ';
run;
ods exclude none;
options label;
proc sql;
select name, format, label
from dictionary.columns
where upcase(libname)='WORK' and
upcase(memname)='TEST';
quit;
proc print data=test label noobs;
run;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
@xxformat_com wrote:
@Ksharp Actually no. Here is an example showing that using the global option is not helping:
options nolabel; ods exclude all; ods output summary=test; proc means data=sashelp.class ; class sex; var height; attrib _all_ label=' '; run; ods exclude none; options label; proc sql; select name, format, label from dictionary.columns where upcase(libname)='WORK' and upcase(memname)='TEST'; quit; proc print data=test label noobs; run;
That actually doesn't "prove" what you may think. Since you are using ODS OUTPUT to create a data set then the rules imposed by that process, ods output, apply which is providing a column heading which makes a lot of sense with the multiple variables that are supported in column with ODS output.
Consider
options nolabel; ods select all; proc summary data=sashelp.class nway ; class sex; var height; output out=test2 min= max= std= /autoname; run; options label; proc sql; select name, format, label from dictionary.columns where upcase(libname)='WORK' and upcase(memname)='TEST2'; quit;
proc print data=test2 label;
run;
The output data set here does not have any "label". SAS will use the variable name as a label when not provided or the option NOLABEL is set.
Proc summary calculates all the same statistics as means and creates data sets. In fact for many years Means did not create sets, just print output, and Summary created sets but no print output. The two have been merged and have some slightly different default behaviors to be consistent will older output. The output statement has the AUTOLABEL option to force adding the statistic text to the existing variable label or variable name if not present.