Hi

Please take a look at two summaries, one using Proc Summary and One

using Proc sql. I got different results using these two. Until now I am

thinking that these two codes are interchangeble. That is I can use one

in place of other. It could be that I am missing something here. Proc

sql gave me the correct results.Any pointers please?

proc summary data=test1;

class var1 speciality;

var samp01-samp12;

output out=test2(drop= _TYPE_ _FREQ_) sum=;

run;

proc sql;

create table test3 as select var1,speciality,sum(samp01) as

samp01,sum(samp02) as samp02,sum(samp03) as samp03,sum(samp04) as

samp04,

sum(samp05) as samp05,sum(samp06) as samp06,sum(samp07) as

samp07,sum(samp08) as samp08,sum(samp09) as samp09,

sum(samp10) as samp10,sum(samp11) as samp11,sum(samp12) as samp12 from

test1 group by var1,speciality;

quit;

Sekhar:

The NWAY option of PROC SUMMARY selects the top-level summary. Results

with the NWAY option should match SAS SQL GROUP BY results for the same

class.

Sig

-----Original Message-----

From: XXXX@XXXXX.COM [mailto: XXXX@XXXXX.COM ]

On Behalf Of Sekhar

Sent: Tuesday, October 18, 2005 9:13 AM

To: XXXX@XXXXX.COM

Subject: Proc Summary , Proc SQL Different results

Hi

Please take a look at two summaries, one using Proc Summary and One

using Proc sql. I got different results using these two. Until now I am

thinking that these two codes are interchangeble. That is I can use one

in place of other. It could be that I am missing something here. Proc

sql gave me the correct results.Any pointers please?

proc summary data=test1;

class var1 speciality;

var samp01-samp12;

output out=test2(drop= _TYPE_ _FREQ_) sum=;

run;

proc sql;

create table test3 as select var1,speciality,sum(samp01) as

samp01,sum(samp02) as samp02,sum(samp03) as samp03,sum(samp04) as

samp04,

sum(samp05) as samp05,sum(samp06) as samp06,sum(samp07) as

samp07,sum(samp08) as samp08,sum(samp09) as samp09,

sum(samp10) as samp10,sum(samp11) as samp11,sum(samp12) as samp12 from

test1 group by var1,speciality; quit;

The NWAY option of PROC SUMMARY selects the top-level summary. Results

with the NWAY option should match SAS SQL GROUP BY results for the same

class.

Sig

-----Original Message-----

From: XXXX@XXXXX.COM [mailto: XXXX@XXXXX.COM ]

On Behalf Of Sekhar

Sent: Tuesday, October 18, 2005 9:13 AM

To: XXXX@XXXXX.COM

Subject: Proc Summary , Proc SQL Different results

Hi

Please take a look at two summaries, one using Proc Summary and One

using Proc sql. I got different results using these two. Until now I am

thinking that these two codes are interchangeble. That is I can use one

in place of other. It could be that I am missing something here. Proc

sql gave me the correct results.Any pointers please?

proc summary data=test1;

class var1 speciality;

var samp01-samp12;

output out=test2(drop= _TYPE_ _FREQ_) sum=;

run;

proc sql;

create table test3 as select var1,speciality,sum(samp01) as

samp01,sum(samp02) as samp02,sum(samp03) as samp03,sum(samp04) as

samp04,

sum(samp05) as samp05,sum(samp06) as samp06,sum(samp07) as

samp07,sum(samp08) as samp08,sum(samp09) as samp09,

sum(samp10) as samp10,sum(samp11) as samp11,sum(samp12) as samp12 from

test1 group by var1,speciality; quit;

Sekhar,

I notice that you do not use the NWAY option on proc summary. This

option will give you the summaries on the toplevel (_type_ = 1)only and

in my opinion will give you the same results as your proc sql.

Regards, Joep

I notice that you do not use the NWAY option on proc summary. This

option will give you the summaries on the toplevel (_type_ = 1)only and

in my opinion will give you the same results as your proc sql.

Regards, Joep

1. SUMMARY Difference between PROC SORT NODUPKEY and PROC SQL?

2. proc freq, proc summary and formatting tables

3. proc formatting errors in proc summary statement

4. Diff of Proc Means Vs Proc Summary

6. proc summary v/s proc means

7. Do I need to use proc summary before proc report for this

8. Do I need to use proc summary before proc report for this report?

9. Faster: PROC Univariate vs. PROC Summary for Kurtosis comput

10. Hash Object vs. Proc SQL: Proc SQL intolerably slower than

11. Hash Object vs. Proc SQL: Proc SQL intolerably slower than hash

12. Different results from stored Proc when run from different programs.

13. Convert VB.NET to TSQL PROC & Reference a Proc from another Proc

14. Proc Tabulate or Proc Freq or Proc Report

3 post • Page:**1** of **1**