BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Pooja98
Fluorite | Level 6

Hi All,

 

I want to import excel file from each week (every friday) and append with the previous week. I need a macro for import and append (append is to convert weekly data into monthly data).

 

For example, if November 2021 contain 4 weeks of friday, i want to import 4 excel files and append to get the November monthly data.

 

Thanks in Advance,

Joe

 

Please help! 

1 ACCEPTED SOLUTION

Accepted Solutions
Tom
Super User Tom
Super User

Where are the EXCEL files?

What are the NAME(s) of the EXCEL files?

What type of EXCEL files are they?

How to you tell which MONTH you want to read the files for?

 

If you want to find all of the FRIDAYs in a month use something like:

data friday;
  target=today();
  do n=1 to 5 while(date < NWKDOM(5, 5, month(target),year(target)));
    date=NWKDOM(n, 5, month(target),year(target));
    output;
  end;
  format target date date9.;
run;

Result

Obs       target    n         date

 1     18JAN2022    1    06JAN2022
 2     18JAN2022    2    13JAN2022
 3     18JAN2022    3    20JAN2022
 4     18JAN2022    4    27JAN2022

View solution in original post

2 REPLIES 2
Tom
Super User Tom
Super User

Where are the EXCEL files?

What are the NAME(s) of the EXCEL files?

What type of EXCEL files are they?

How to you tell which MONTH you want to read the files for?

 

If you want to find all of the FRIDAYs in a month use something like:

data friday;
  target=today();
  do n=1 to 5 while(date < NWKDOM(5, 5, month(target),year(target)));
    date=NWKDOM(n, 5, month(target),year(target));
    output;
  end;
  format target date date9.;
run;

Result

Obs       target    n         date

 1     18JAN2022    1    06JAN2022
 2     18JAN2022    2    13JAN2022
 3     18JAN2022    3    20JAN2022
 4     18JAN2022    4    27JAN2022

Pooja98
Fluorite | Level 6

Excel files names are:

1. 20220107

2. 20220114

3. 20220121

4. 20220128

 

At the end of the month, i want to import the data for the mentioned above 4 weeks and want to append to get the entire week data, "Looking for a import code"

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 2 replies
  • 565 views
  • 0 likes
  • 2 in conversation