BookmarkSubscribeRSS Feed
deleted_user
Not applicable
Good morning all,

Let me start out by letting you know that my SAS experience is minimal at best. So I need some help altering a macro written a few years ago by someone who left my firm long before I started.

Over the past few years we've been running a job (posted below) that takes one somewhat large data file (haver.sas) and parses it into three files based on the frequencies of the data in the file (i.e. it creates three new SAS files - one for annual data, one for quarterly, and one for monthly).

I've gotten a request to add weekly and daily data to the original haver.sas file. So I need to alter the SAS job to also parse and create new files for these data.

My first (and really only) thought was to just add two lines of code at the bottom, which were %process(weekly) and %process(daily). This did not work at all, and in fact caused the whole job to stop working altogether. So after restoring the affected folders back to the day before I started messing with them, I'm back to square one.

Any and all thoughts would be greatly appreciated! And here is the code:

options nocenter;
/*... HAVER.sas is copied from g:\deptdata\research\haver\haver.sas .*/
filename haver 'g:\deptdata\research\Haver\dbupd\sashaver\haver.sas';
/*... sas is a directory containing SAS data sets ..................*/
libname sas 'g:\deptdata\research\Haver\dbupd\sashaver\saslibrary';
%macro process(frequency);
%*==> This section creates SAS data sets from the Haver data ...........;
proc datasource filetype=haver
infile=haver
interval=&frequency
out=sas.&frequency;
run;
%mend;
%process(annual)
%process(quarterly)
%process(monthly)
5 REPLIES 5
ieva
Pyrite | Level 9
Have never used this procedure, but if no other ideas, check:

http://support.sas.com/documentation/cdl/en/etsug/60372/HTML/default/etsug_datasrc_sect006.htm

So it could be
%process (week);
%process (day);

But it is only a guess, so hopefully somebody with more experience will answer.

Good luck with your work!
Doc_Duke
Rhodochrosite | Level 12
According to the documentation for DATASOURCE, the weekly and daily data are not available for a file from Haver Analytics:

http://support.sas.com/documentation/cdl/en/etsug/60372/HTML/default/etsug_datasrc_sect051.htm
deleted_user
Not applicable
Interesting, thanks for the info. I will check with Haver and see what they suggest.
deleted_user
Not applicable
Well Haver was no help. I tried altering the code from a macro using 'datasource' to using the SASEHAVR engine but that didn't work either.

Maybe someone out there happens to work with Haver and can help. If not, thanks to those who responded and at least pointed me in the right direction.
deleted_user
Not applicable
Going in a new direction. Instead of lumping the daily and quarterly data in with the rest, I am creating them separately. This creates simple haverd.sas and haverw.sas files.

Is there a simple SAS program I can run that will read these in and spit them out/save them as .sas7bdat files? Stat/Transfer won't read the simple .sas files.

I'm covering as much ground in the support area myself, not just looking for someone to do my job for me, but I admit being given the code would be faster.

Thanks!

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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