Date: Fri, 7 Jan 2000 12:53:05 +0000
Reply-To: Peter Crawford <Peter@CRAWFORDSOFTWARE.DEMON.CO.UK>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Peter Crawford <Peter@CRAWFORDSOFTWARE.DEMON.CO.UK>
Organization: Crawford Software Consultancy Limited
Subject: Re: challenging problem
Sounds like a job for SAS/AF, if interaction with a user is necessary,
but not otherwise.
One could use call execute() to generate the code
Assume you have a macro %foremacr needing parameters to generate the
required forecasts from variables of the merged data.
merge data.one( in=one )
dat2.two( in=two );
if one and two then delete;
call execute( '%foremacr(' );
call execute( 'parm1=' || data variables as necessary );
call execute( ',parm2=' || data variables as necessary );
call execute( ',parm3=' || data variables as necessary );
call execute( ',parmN=' || data variables as necessary );
call execute( ' ); ) );
The call execute() above is stylised to give the idea.
I hope it becomes obvious that call execute() just generates code from
run-time values in variables and constants.
Hope this helps
Gijs Noordhoek <firstname.lastname@example.org> writes
>Here's a challenge for all SAS expert out there:
>I'm merging two datasets containing new data, provided by two different
>companies. There's a partial overlap in the two datasets, and when
>overlap occurs, several checks have to be done to be able to choose the
>figures from one of the datasets as the actual data.
>One possible check is to see whether the values compare with the figure
>obtained by a lineair forecast from past data.
>The problem is: I cannot create a forecast from within the datastep.
>First of all because I cannot pass datastep variables to a macro from
>within the datastep (because macro variables are set after the 'run'
>command has passed), second of all because you cannot nest datasteps or
>run a proc forecast within a datastep.
>Creating all possible forecasts in advance is impossible: I would have
>to create at least 10000 forecasts for each month in the database,
>containing up to 10 years. Quite a waste of processing time when you
>imaging that I will probably only need a dozen of them.
>What I would like to be able to do, is to run an independent SAS
>program that I pass a few parameters to. Just as a *function* works in
>any ordinary programming language.
>Does anyone know if this is somehow possible and if not, if there's an
>alternative way of solving this problem?
>Sent via Deja.com http://www.deja.com/
>Before you buy.