Hi ,
Could someone point to me where I am going wrong????
ERROR: There is a statistic but no ANALYSIS usage associated
with the column defined by the following elements.
Name Usage
-------------------------------- --------
mean STATISTIC
data test;
input Category$ value;
cards;
Biscuits 20
Biscuits 25
Biscuits 19
Biscuits 33
Biscuits 10
Choclate 80
Choclate 30
Choclate 22
Choclate 09
Oranges 12
Oranges 20
Oranges 20
Oranges 25
Oranges 33
Oranges 36
;
run;
ods html file='x.html' style=sasweb;
proc report data=test nowd ;
columns Category value(mean);
define Category/group;
define value/analysis;
break after Category/summarize skip ol style=[font_weight=bold font_style=italic font_size=9pt];
rbreak after / summarize dul style =[font_weight=bold font_style=italic font_size=9pt];
run;
ods html close;
HI,
Then I'm confused. If you understood the concept I explained, why did you post code showing VALUE(MEAN) without showing the comma? That doesn't make sense in terms of REPORT syntax. The new code you posted makes a bit more sense. ACROSS is a usage that allows PROC REPORT to do cross-tabular reports, by making a column (or set of columns) for each UNIQUE value of the ACROSS item. In your example code, the ACROSS item is the LAB variable and so you would have 1 unique column for every value of LAB and then underneath each unique value of LAB, you would have the MEAN and MEDIAN of the VALUE variable. As I explained in my previous post...see the @2 reason for using parentheses that I gave...you use parentheses with a comma when you want to ask for more than 1 statistic or variable to appear underneath an ACROSS item.
In the code shown in my screen shot and code, using SASHELP.CLASS, the #3 report is similar to what you show in your code (except it is a complete working program) and the #4 example is the more common usage of ACROSS, where there is a GROUP variable going down the ROWS and the ACROSS item going across the columns.
cynthia
Hi,
I suspect that PROC REPORT is as confused as I am. I don't speak in error messages, however. Why do you have value(mean) in your code? That is not usual PROC REPORT syntax (without a comma between them). PROC REPORT thinks you are asking for the MEAN statistic, but does not know which variable should be used to generate the mean. There are 2 ways that you could ask for the mean statistic for the variable named VALUE. Consider the following example (shown in the screen shot) using SASHELP.CLASS, where AGE is the group item and HEIGHT is the ANALYSIS item. Usually parentheses are used for one of two reasons 1) to request a spanning header (which you are not doing) or 2) to request more than 1 variable to get nested underneath an ACROSS item (which you are not doing). So your parentheses aren't doing what I suspect you think they are doing. You must have tried some syntax from another language or procedure thinking that the value(mean) would generate the mean statistic for the VALUE variable. However, you only need to ask for the MEAN statistic on the DEFINE statement for VALUE (Method 1) or you need to "cross" or "nest" the MEAN statistic with the VALUE variable by using the comma operator (Method 2).
cynthia
Hi,
Thanks for the reply. I understood the concept you explained in your prior post.
I alsio wanted to learn what this syntax means for the below example???
column lab,VALUE,(mean median);
define lab/across order=data '';
define VALUE/analysis ];
ID lab value
101 heme 33
101 heme 29
101 platelet 5
101 platelet 3
101 platelet 8
101 platelet 9
102 heme 33
102 heme 29
102 heme 25
102 heme 23
102 platelet 8
102 platelet 9
HI,
Then I'm confused. If you understood the concept I explained, why did you post code showing VALUE(MEAN) without showing the comma? That doesn't make sense in terms of REPORT syntax. The new code you posted makes a bit more sense. ACROSS is a usage that allows PROC REPORT to do cross-tabular reports, by making a column (or set of columns) for each UNIQUE value of the ACROSS item. In your example code, the ACROSS item is the LAB variable and so you would have 1 unique column for every value of LAB and then underneath each unique value of LAB, you would have the MEAN and MEDIAN of the VALUE variable. As I explained in my previous post...see the @2 reason for using parentheses that I gave...you use parentheses with a comma when you want to ask for more than 1 statistic or variable to appear underneath an ACROSS item.
In the code shown in my screen shot and code, using SASHELP.CLASS, the #3 report is similar to what you show in your code (except it is a complete working program) and the #4 example is the more common usage of ACROSS, where there is a GROUP variable going down the ROWS and the ACROSS item going across the columns.
cynthia
Hi
for the below data I am requesting N Mean and MEDIAN
How can I get 10.0 format for N
and 10.2 format for MEAN AND MEDIAN??
column lab,VALUE,(n mean median);
define lab/across order=data '';
define VALUE/analysis;
ID lab value
101 heme 33
101 heme 29
101 platelet 5
101 platelet 3
101 platelet 8
101 platelet 9
102 heme 33
102 heme 29
102 heme 25
102 heme 23
102 platelet 8
102 platelet 9
Your best bet is to define a column alias.
proc report data=test nowd ;
columns Category value,(mean=vmean median=vmedian);
define Category/group;
define value/analysis;
define vmean/format=10.2;
define vmedian/format=10.;
break after Category/summarize skip ol style=[font_weight=bold font_style=italic font_size=9pt];
rbreak after / summarize dul style =[font_weight=bold font_style=italic font_size=9pt];
run;
Hi,
Thanks for the reply,
Somehow it does not work that way
I get an ERROR :variable N,MEAN, and STD are not on FILE
Thanks
1. New question=New Thread/Post
2. Post your code.
Then you're not paying attention to the detail in my post.
mean=vmean
...
define vmean/ ... ;
You can't use MEAN in the define statement. You need an alias, hence VMEAN.
And agreed, this should really be a new post.
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.