BookmarkSubscribeRSS Feed
BaalaRaaji
Quartz | Level 8

Hi Guys,

 

Can you please help me to  write a code for weekly report using weekday function and to automatically run on every monday morning.

 

I got daily data like below for 6 months..

 

calendar_date_FREQ_Balance
10Jan201951801480096401.80
11Jan201951851479431521.37
12Jan201951851479431521.37
13Jan201951851479431521.37
14Jan201951831479938213.77
15Jan201951921481255273.06
16Jan201951981486672020.87
17Jan201951991481255277.06
18Jan201960001486672080.87

 

Logic for:  -

- the report should run every monday to pick friday data only (like 18th jan 2019)..

- the report should compare last two fridays numbers (like 11th jan 2019 and 18th jan 2019)

 

appreciate if you can send me the sample codes using weekdays for weekly report using daily data tables..

 

thanks you

1 REPLY 1
ChrisNZ
Tourmaline | Level 20

You don't really say what you want.

This answers the expressed need:

data WANT;
  set HAVE;                       
  where put(CALENDAR_DATE,downame. -l)='Friday';
  DELTA=(BALANCE-lag(BALANCE))/lag(BALANCE);
  format DELTA percent8.2;
run;

 

CALENDAR_DATE BALANCE DELTA
11JAN2019 1479431521.4 .
18JAN2019 1486672080.9 0.49%

 

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