|
Grace, I think Allan was correct that the view will contain the value of
&perssem, rather than the macro reference. As he pointed out, you could apply
the WHERE in subsequent processing instead of in the view. I can imagine
performance reasons why you might want to do it the way you proposed.
I can think of at least one work-around:
Store the value of &perssem in a datastep variable and merge it in the view:
DATA WORK.TEMP;PERSSEM="&perssem";OUTPUT;STOP;RUN;
data stuall.persv / view = stuall.persv;
IF _N_ EQ 1 THEN SET TEMP;
set stuall.personal;
by ssn semnum;
IF semnum <= PERSSEM;
if last.ssn then output;
run;
This is ugly. It replaces the WHERE with IF, which costs I/O. It requires the
dataset TEMP both when the view is defined and when it is accessed.
Tim Berryhill - Contract Programmer and General Wizard
TWB2@PGE.COM or http://www.aartwolf.com/twb.html
Frequently at Pacific Gas & Electric Co., San Francisco
The correlation coefficient between their views and
my postings is slightly less than 0
----------------------[Reply - Original Message]----------------------
Sent by:"Grace La Torra" <grace@NMSU.EDU>
I am creating a view of a data set using the following code:
data stuall.persv / view = stuall.persv;
set stuall.personal;
by ssn semnum;
where semnum <= &perssem;
if last.ssn then output;
run;
I am trying to build a view that will change depending on the macro
variable &perssem. In other words, when perssem is set to 60 the view
will be different from when perssem is set to 64. The kicker here is
that I don't want the macro variable to be resolved when the view is
created, but when the view is accessed.
Does anybody have any words of wisdom?
Thanks,
Grace La Torra
Research Analyst
Institutional Research and Planning
New Mexico State University
=====================================================================
|