BookmarkSubscribeRSS Feed
Stalk
Pyrite | Level 9

I need to create a table with overall counts, last weeks counts as well as daily counts( Sunday to Saturday).

Some time my daily counts table is failing because there is no data for Sunday? How can I handle this?

 

data have;
input product description $ total last_week day :date9. amount_received;
cards;
1235 Item1 3173 1070 07FEB2021 73
1235 Item1 3173 1070 08FEB2021 34
5432 Item4 340 96 07FEB2021 19
5432 Item4 340 96 08FEB2021 2
6574 Item5 5 2 08FEB2021 3
;
proc sql;
create table track_daily as
select product, description, Day format=date9., sum(amount_received) as Received
from have
group by product, description, Day;
quit;

1 REPLY 1
SASKiwi
PROC Star

Wouldn't it be better to change your processing to handle missing days rather than insert dummy data?

 

Please post the SAS log of the code that is failing.

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 1 reply
  • 772 views
  • 0 likes
  • 2 in conversation