Date: Mon, 18 Jul 2005 16:09:14 -0600
Reply-To: Roberto Valdivia <valdivia@MONTANA.EDU>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Roberto Valdivia <valdivia@MONTANA.EDU>
Subject: Re: Help creating new variables
In-Reply-To: <OF3840B89C.EBDE7A16-ON85257040.005897E7@dom.com>
Content-Type: text/plain; charset="US-ASCII"
Thanks Nat, this code solved my problem.
Roberto.
-----Original Message-----
From: Nathaniel_Wooding@dom.com [mailto:Nathaniel_Wooding@dom.com]
Sent: Saturday, July 16, 2005 10:18 AM
To: Roberto Valdivia
Cc: SAS-L@LISTSERV.UGA.EDU
Subject: Re: Help creating new variables
Roberto
There are several ways that you could write your array statement.
Nat Wooding
data a;
input d1-d5;
cards;
1 2 3 4 5
6 7 8 9 10
11 12 13 14 15
data b;
set a;
retain b0 -1.5;* I do not know where you will pick up b0 so I am hard
coding it here.
* it could just as well be a variable in you input
data set. you may
* want to drop it or simply write it direcly in your
calculation state
ments below;
array one d: ;*this is a wild card reference to any variable starting
with the letter d;
array two wd1 - wd5 ;
do over one;
two= exp(b0*one*one);
end;
proc print;
run;
|---------+---------------------------->
| | Roberto Valdivia |
| | <valdivia@MONTANA|
| | .EDU> |
| | Sent by: "SAS(r) |
| | Discussion" |
| | <SAS-L@LISTSERV.U|
| | GA.EDU> |
| | |
| | |
| | 07/15/2005 05:36 |
| | PM |
| | Please respond to|
| | Roberto Valdivia |
| | |
|---------+---------------------------->
>---------------------------------------------------------------------------
-----------------------------------------------------|
|
|
| To: SAS-L@LISTSERV.UGA.EDU
|
| cc:
|
| Subject: Help creating new variables
|
>---------------------------------------------------------------------------
-----------------------------------------------------|
Hi all,
I've recently posted a message asking for help with a Macro, I've got an
answer that solved the main problem, however I'm having problems trying to
do something that might be easy to do:
I have a set of 2000 observations and the following variables:
Loc fips b0 d1 d2 d3...d2000 (so I have 2000 "d's" = number of
observations).
I need to create other 2000 variables: wd1, wd2 ..wd2000 as:
wd1=exp(-bo*d1*d1)
wd2=exp(-bo*d2*d2) or in general wdX=exp(-b0*dX*dX) where X=1,2...2000
Could anyone please help me with this?.
Thanks,
Roberto.
-----------------------------------------
CONFIDENTIALITY NOTICE: This electronic message contains information which
may be legally confidential and/or privileged and does not in any case
represent a firm ENERGY COMMODITY bid or offer relating thereto which binds
the sender without an additional express written confirmation to that
effect. The information is intended solely for the individual or entity
named above and access by anyone else is unauthorized. If you are not the
intended recipient, any disclosure, copying, distribution, or use of the
contents of this information is prohibited and may be unlawful. If you have
received this electronic transmission in error, please reply immediately to
the sender that you have received the message in error, and delete it.
Thank you.