BookmarkSubscribeRSS Feed
SmcGarrett
Obsidian | Level 7

Hello,

 

I am attempting to combine multiple data files based on a date prefix.

 

All of the files are located in one folder and have the date prefix of YYYYMMDD. They are excel files. 

Capture111.JPG

 

I would like to be able to give a start date, say 20160423 and have SAS return the appended files for a given amount of days....say 7, or 14, or 21. 

 

 

 

3 REPLIES 3
Reeza
Super User

Do you have any part of this process started?

 

This can't be done in EG via point and click, it requires a macro solution via code.

 

You'll need to write the base code and looping over the specified dates is easy enough.

 

IF YOUR DATA IN THE FILES IS NOT WELL STRUCTURED AND CONSISTENT THIS WILL NOT WORK. 

When importing data from Excel SAS guesses at types, if your data is inconsisten then the types may not match between datasets and you'll have to deal with that issue.

SmcGarrett
Obsidian | Level 7

Yes, I know this will require a macro....

 

The files are all the same format so they are structured perfectly. They were actually originally in one large files but then split out based on the day. 

 

The reason I did not leave them all in one file is because I will be using a rolling-window to look at customers. 

 

 

Reeza
Super User

So you have a SAS dataset somewhere with this data? Or a single file? Honestly that would be easier and wouldn't require a macro. 

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!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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