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-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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