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.

SAS Innovate 2025: Call for Content

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 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 472 views
  • 0 likes
  • 2 in conversation