BookmarkSubscribeRSS Feed
Ronein
Onyx | Level 15

Hello,

I would like to do the following task.

I have one  data set with transcations of purcahses in a shop with columns: ID,date,amount. (name of data set is Trans_tbl)

I have multiple CSV files called tYYYYMMDD with following columns: ID,date,balance

Please note that for each business day there should be a CSV file.

The task is :

1-Create a data set with information of business days

It will be done by taking distinct dates from Trans_tbl

2-Create a Loop that do the following"

A-Select transcations  that were done in date X (From data set Trans_tbl)

B-Import CSV File in date X 

C-Import CSV File in date X-1

D-Merge(Left Join) data set Trans_tbl with CSV File in date X (To  get column of balance in date X)

E-Merge(Left Join) data set created in step D with CSV File in date X-1 (To  get column of balance in date X-1)

Please note that date X-1 is one business day before date X 

F-Delete data sets :CSV File in date X,CSV File in date X-1 (Because they are very big data sets )

Any ideas how to do it?

 

 

 

 

5 REPLIES 5
Ronein
Onyx | Level 15

Hello, From 01.01.2020 till today

Ronein
Onyx | Level 15

Trans_tbl is 200,000 rows 

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
  • 5 replies
  • 988 views
  • 0 likes
  • 2 in conversation