Thank you, that's a great suggestion. I made the edits and now I have some follow up questions. data Honda;
input CLASSES $ RATIO N;
cards;
C 0.75 500
B 1.00 300
A 1.25 400
;
data Porche;
input CLASSES $ RATIO N;
cards;
C 0.90 250
B 1.00 100
A 1.25 50
;
PROC SQL;
CREATE TABLE WORK.COMPARISON as
SELECT 'Zonda' AS Car label='Car Name', sum(N) AS n label='Total # of Cars', SUM(RATIO * N)/SUM(N) AS Ratio Label='Weighted Ratio' format=percent6.2 FROM WORK.Honda
UNION
SELECT 'Porche' AS Car, sum(N) AS n, SUM(RATIO * N)/SUM(N) AS Ratio FROM WORK.Porche;
QUIT;
PROC SQL;
CREATE TABLE WORK.FINAL AS
SELECT * FROM WORK.COMPARISON
UNION
SELECT 'TOTAL' AS CAR,. AS n, SUM(n) AS RATIO FROM WORK.COMPARISON;
QUIT;
PROC PRINT DATA=WORK.FINAL LABEL;
RUN; SAS seems to sort all the rows added by the first column regardless of the order in which they got put in, how would I go about rearranging the rows in the way I want them to be? For example if I had Honda, GM, Toyota, BMW and I wanted them in that order in particular (just for the report) and not sort them alphabetically. Also, is it possible for one column to have different formatting? So I would like the final report to show: Car Name Total # of Cars Weighted Ratio Zonda 1200 97% Porche 400 98% TOTAL 1600 Trying to mimic Excel report on SAS is proving to be big challenge in terms of formatting. EDIT: Just adding on, would it be possible to remove the Obs column in the report?
... View more