Date: Tue, 22 Apr 2003 14:25:02 -0400
Reply-To: jrholdcraft@AEP.COM
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Jennifer R. Holdcraft" <jrholdcraft@AEP.COM>
Subject: Data step set issue - knowing which dataset obs is from - but IN=
may not be ideal
Content-Type: text/plain; charset="us-ascii"
I would really appreciate some ideas/help with the following issue I'm
dealing with.
Basically, I've got a bunch of exception datasets that I'm combining into
one large set. The actual names of the individual datasets convey
information about certain data properties that I want to put into 3 new
attribute variables. Let's say I have six datasets (I actually have many
more) named : gas_price_option
gas_rbid_option
power_price_forward
power_rbid_forward
coal_price_forward
coal_rbid_forward
and in my final large dataset I want 3 new variables called commodity
(gas, coal), type (price, rbid), and instrument (option, forward)
I actually have a way of accomplishing the task - I currently have a
macro that preprocesses each of individual datasets and parses the dataset
name to construct and add the attribute variables before setting them all
together and making the large dataset), but was wondering if there was a more efficient or one-step method.
At first, I was trying to use the in= option on each dataset - but that
isn't necessarily ideal because it ends up having to be unique for each
dataset and then involves a large if-then or select when statement to set
the 3 attribute vars to their correct values for that dataset.
i.e. data big;
set gas_price_option (in=gpo)
gas_rbid_option (in=gro)
gas_price_forward (in=gpf)
gas_rbid_forward (in=grf)
coal_price_forward (in=cpf)
coal_rbid_forward (in=crf)
nasty if/then or select statement to construct commodity, type
and instrument
run;
I also was thinking about making the IN= value equal to the dataset name,
but realized there is no variable holding this value so I could parse it,
just a 0/1 var of that name (At least this problem finally made me really
think about what IN= is actually doing!)
Am I missing something simple/simpler?
Thanks!
Jennifer R. Holdcraft
AEP Market Risk Oversight
614-583-6761
Audinet 220-6761
jrholdcraft@aep.com