Date: Thu, 1 Feb 2001 21:31:31 +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: Additional Q: How to direct output files based on avariable?
Content-Type: text/plain;charset=iso-8859-1
Hmmm...... Have another $.02
Jack Hamilton <JackHamilton@FIRSTHEALTH.COM> Writes
>Sounds like a good topic for mail to SUGGEST@SAS.COM.
>
>Syntax could be something like this:
>
> data _dynamic_;
> name1 = 'newdataset1';
> name2 = 'newdataset2';
> a = 1; b = 2;
> output _dynamic_ (keep=a outname=name1)
> _dynamic_ (keep=b outname=name2);
> run;
>
>The supervisor would have more stuff to keep track of, of course, but there's
>nothing I can think of in the current syntax which prohibits dynamic output.
I think changing the dataset creation from a compile time definition to
a runtime conditional, might be more than a syntax issue.
>You'd probably have to live with the restriction that the first instance defines
>the output variables in the data set.
Don't see why output variables can't be defined like normal ?
The data step data vector defines the variables available. The keep=
list would function like normal. Any breach of the rules would have to
be an execution time error. Already we get these when trying to output
duplicates when there is a unique-key index, or when modify breaks an
integrity constraint.
>
>Setting the input data set at run time would be more difficult, since that would
>require changing the PDV. It should be possible to do it by using a template
Dynamic definition of the data being "set" is available with the open()
function and call set() call routine and fetch()/ fetchobs() functions.
Care would have to be taken over variable names, but this is not a
casual code situation !
>data set. Whichever data set is dynamically assigned at run time would have to
>look like the template (same variable names, positions, and lengths); there's a
>similar data step capability already with the REDIRECT statement.
>
>
>
>
>--
>JackHamilton@FirstHealth.com
>Development Manager, Technical Group
>METRICS Department, First Health
>West Sacramento, California USA
>
>
>>>> "Richard DeVenezia" <radevenz@IX.NETCOM.COM> 02/01/2001 12:01 PM >>>
>Gunnar:
>
>There is no filevar equivalent option for the OUTPUT statement (.e.g there
>is no OUTVAR=, likewise there is no SETVAR= either corresponding to SET).
>
>When input data has to go to different output datasets based on input
>content you will have to two pass the data.
>One pass to determine the output datasets (and perhaps a matching criteria
>expression) into macro vars (or perhaps the first pass writes a program for
>the second pass) and one pass to input the data, evaulate the criteria and
>distribute the output.
>
>--
>Richard DeVenezia - SAS Macros and AF Tools
>http://www.devenezia.com
>
>"Gunnar Keen" <gunnar.keen@DB.COM> wrote in message
>news:OF5A26C9E2.E167DFD1-ON412569E6.004F07DE@db.com...
>> Hi SAS-L,
>>
>> as I see it, the FILEVAR = option is very useful for dividing SAS Datasets
>based on the value of variables, when writing different text-files.
>> But what will I do when I want to write several SAS Data Sets? Is there
>something equal to filvar for Data Sets? Or do I have to read all possible
>values beforehand and create macrovars?
>>
>> Regards,
>>
>> Gunnar Keen
>>
>>
>> --
>>
>> Diese E-Mail enthält vertrauliche und/oder rechtlich geschützte
>Informationen. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail
>irrtümlich erhalten haben, informieren Sie bitte sofort den Absender und
>vernichten Sie diese Mail. Das unerlaubte Kopieren sowie die unbefugte
>Weitergabe dieser Mail ist nicht gestattet.
>>
>> This e-mail may contain confidential and/or privileged information. If you
>are not the intended recipient (or have received this e-mail in error)
>please notify the sender immediately and destroy this e-mail. Any
>unauthorised copying, disclosure or distribution of the material in this
>e-mail is strictly forbidden.
--
Peter Crawford