| Date: | Mon, 5 Jan 2004 11:27:13 -0500 |
| Reply-To: | "Wainwright, Andrea" <andrea.wainwright@CAPITALONE.COM> |
| Sender: | "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU> |
| From: | "Wainwright, Andrea" <andrea.wainwright@CAPITALONE.COM> |
| Subject: | How to make them into macro vars? |
| Content-Type: | text/plain |
|---|
Ok, I know this shouldn't be as hard as I am making it.
Here is where my sample code stands today.
*************************************************************
filename scrinput "U:\My Documents\ISP\CR's\444 subprime
model\scorinput.txt";
%macro model;
filename avgs "U:\My Documents\ISP\CR's\444 subprime model\avgs.txt";
if _n_=1 then do;
infile avgs;
input avg1 avg2 avg3 avg4 avg5;
end;
retain avg1 avg2 avg3 avg4 avg5;
if x<2 then y=avg1*x;
else if x<4 then y=avg2*x;
else if x<6 then y=avg3*x;
else if x<8 then y=avg4*x;
else y=avg5*x;
%mend;
data temp;
infile scrinput;
input x;
%model
run;
**************************************************************
With avgs.txt as:
10 20 30 40 50
And scorinput.txt as:
1
2
3
4
5
6
7
8
9
This does what I want it to do except I would rather have the values
avg1-avg5 as a macros rather than 5 fields for all 9 records (in actuality,
there will be 10 such fields and millions of records, hence why the macro
would be a big space saver)
My only constraint is that I can only make changes to the macro, not the
data step.
How do I read them in and store them as macro vars rather than adding them
to the dataset given the constraint that this all has to be done within the
macro which has to run within the datastep. Is it even possible to avoid
adding them to the dataset?
Also, comments on more efficient, eloquent, etc. coding are always welcome.
Thanks
PS I am sure it will require call symput or something similar, but I am not
as familiar with that and could use some help.
**************************************************************************
The information transmitted herewith is sensitive information intended only
for use by the individual or entity to which it is addressed. If the reader
of this message is not the intended recipient, you are hereby notified that
any review, retransmission, dissemination, distribution, copying or other
use of, or taking of any action in reliance upon this information is
strictly prohibited. If you have received this communication in error,
please contact the sender and delete the material from your computer.
|