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-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

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
  • 353 views
  • 0 likes
  • 2 in conversation