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%

 

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