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

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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