Hi there,
I have written this code for a simple proc means
proc means data=have SUM stackodsoutput; |
var E F; |
class A B C D; |
run; |
and I am getting this
A | B | C | D | Variable | Sum |
Yellow | Yes | Italy | Coffee | E | $10 |
F | 3 | ||||
Yellow | Yes | London | Milk | E | $100 |
F | 3 | ||||
Green | Yes | Ireland | Whole Milk | E | $25 |
F | 3 |
what I would like is
A | B | C | D | E | F |
Yellow | Yes | Italy | Coffe | $10 | 3 |
Yellow | Yes | London | Milk | $100 | 3 |
Green | Yes | Ireland | Whole Milk | $25 | 3 |
to have the var variables side by side instead of one below the other. Is that possible.
I would appreciate your help.
Thanks
Thank you! Let me try PROC TABULATE OR PROC REPORT
You missed option NWAY ,since you are using CLASS.
proc means data=have SUM stackodsoutput NWAY;
Thank you !
I have used PROC REPORT to get the table in the format that I wanted
proc report data=have; |
column A B C D E F; |
define A/group; define B/group; define C/group; define D/group; define E/analysis sum; define F/analysis sum; |
run; |
But I would like the E and F variables in the descending order, is there a way to do that.
Thank you very much!
It is interesting. Looks like ORDER= option in PROC REPORT is not working . Try PROC SQL.
proc sql;
select age,sum(weight) as sum
from sashelp.class
group by age
order by 2 desc;
quit;
@Gladis6680 wrote:
Thank you !
I have used PROC REPORT to get the table in the format that I wanted
proc report data=have; column A B C D E F; define A/group;
define B/group;
define C/group;
define D/group;
define E/analysis sum;
define F/analysis sum;
run; But I would like the E and F variables in the descending order, is there a way to do that.
Thank you very much!
How can they both be descending?
Do you mean you want it descending by E and then within the value of E descending by F?
You probably need to summarize first and then make a report.
proc summary nway data=have ;
class a b c d;
var e f ;
output out=summary sum= ;
run;
proc sort data=summary ;
by descending e descending f;
run;
proc print data=summary;
var a b c d e f;
run;
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 16. Read more here about why you should contribute and what is in it for you!
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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: