BookmarkSubscribeRSS Feed
deleted_user
Not applicable
I used following PROC SQL coding to retrive data from data warehouse by ODBC method. I want to group data by customer ID. However the final outcome does not show unique ID. The SAS log mentioned that "The query requires remerging summary statistics back with the original data". Does anyone have similar issue before and know how to solve it? Thanks!



PROC SQL;
CREATE TABLE d_act AS
SELECT
national_id
,snapshot_date
,Max(credit_limit_Amt) AS Cr_limit
FROM dw.ACCT
WHERE Snapshot_Date = '30JUN2008'D
GROUP BY id;

NOTE: The query requires remerging summary statistics back with the original data.
2 REPLIES 2
Olivier
Pyrite | Level 9
When SAS tells you so, that's because it found items in the SELECT part that were neither statistics, neither mentionned in the GROUP BY part.
Here you have two problems at the same time : 1) the NATIONAL_ID is typed ID in the GROUP BY (--> SQL won't connect both) and 2) the SNAPSHOT_DATE is neither a statistic, neither a GROUP BY element.
I agree that SNAPSHOT_DATE is logically constant, since it appears in the WHERE part, but that's not taken into account by SQL.
So I would try the following code :
[pre]
PROC SQL;
CREATE TABLE d_act AS
SELECT
national_id
,snapshot_date
,Max(credit_limit_Amt) AS Cr_limit
FROM dw.ACCT
WHERE Snapshot_Date = '30JUN2008'D
GROUP BY national_id, snapshot_date
;
QUIT ;
[/pre]
Regards.
Olivier
deleted_user
Not applicable
Thanks Olivier for your help!

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

What is Bayesian Analysis?

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 956 views
  • 0 likes
  • 2 in conversation