Date: Fri, 14 Jan 2005 17:29:27 -0500
Reply-To: "Chang Y. Chung" <chang_y_chung@HOTMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Chang Y. Chung" <chang_y_chung@HOTMAIL.COM>
Subject: Data Step View. Was(Re: Dynamic method to change numeric and
character missing value)
Hi,
About the data step views... Once you get used to the idea of a data step
view, the natural next question is "can I parameterize it?" For example, the
following view converts character missing values to "?"'s only for the data
set, one.
/* test data */
data one;
set sashelp.class;
/* make some missings */
if _n_ <= 3 then do;
sex = "";
age = .;
height = .;
end;
run;
/* a data step view with a hard coded input data set name */
data missQ / view=missQ;
set one;
array chars _character_;
do over chars;
if missing(chars) then
chars = repeat('?', 32767-1);
end;
run;
So, instead of hard coding the dataset name, we can try to put the data set
name with a macro variable, instead. like:
data missQ / view=missQ;
set &data; /* <-- changed */
array chars _character_;
do over chars;
if missing(chars) then
chars = repeat('?', 32767-1);
end;
run;
So that we can later use this view like:
%let data=one;
proc print data=missQ;
run;
Or if we had a data set two, then
%let data=two;
proc print data=missQ;
run;
Well, good idea -- I thought initially. However, it turned out that the new
view (with "&data") does not compile! :-(
So, here is the open question: Can we "parameterize" data step view at all,
or not?!
I have a partial answer and am hoping someone could share a more complete
answer with us.
I would like to direct this question to specially for those who took and
passed the base certification exam!!
(hint: http://support.sas.com/certify/samples.html)
Happy Friday!
Cheers,
Chang