Desktop productivity for business analysts and programmers

Combining (Appending) Data Sets using a Date Prefix

Reply
Contributor
Posts: 34

Combining (Appending) Data Sets using a Date Prefix

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. 

 

 

 

Super User
Posts: 19,167

Re: Combining (Appending) Data Sets using a Date Prefix

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.

Contributor
Posts: 34

Re: Combining (Appending) Data Sets using a Date Prefix

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. 

 

 

Super User
Posts: 19,167

Re: Combining (Appending) Data Sets using a Date Prefix

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. 

Ask a Question
Discussion stats
  • 3 replies
  • 229 views
  • 0 likes
  • 2 in conversation