BookmarkSubscribeRSS Feed
Abhi2008
Calcite | Level 5


Hi All,

We have multiple sas7bdat files saved on a network drive and a reference file which lists the file names that need to be combined.

How can I do put them together using data steps? 

Thank you for your time.

3 REPLIES 3
Reeza
Super User

Read the list of files from the reference file into a macro variable, if it's less than 64K characters and include that in your set statement.

proc sql noprint;

select name into :ref_list separated by " " from reference_list;

quit;

data want;

set & ref_list;

run;

Abhi2008
Calcite | Level 5

And we need this job to run on weekly basis to check for new files.can you please list out the software that is required and the process. I 'm pretty new with SAS tool.

Thanks a lot for your help

Patrick
Opal | Level 21

"Check on a weekly basis" sounds like you need to schedule your job. If it's just "run weekly" then any scheduler will do (Cron, Task Scheduler,....).

"check for new files": What identifies a new file? Safest would be you maintain a list of already processed files and then compare this list with your control file.

You seem to have a process where you add some weekly snapshots to a "analytical base table". Assuming this table is a SAS data set and if the structure of the weekly files is stable (same columns with same attributes) then you should eventually consider to use Proc Append instead of a data step. This would avoid processing ALL the data every single week.

An alternative approach: You could also create a view over the individual SAS files. This way you would only need to re-create the view once a week including all files available.

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!

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