Hi,
When I run this code I get an error
Apparent symbolic reference DSET not resolved
Could you help me overcome this??
options symbolgen mlogic;
You cannot refer to the value of local macro variables (all macro parameters are local to the macro) outside of the macro. So you cannot refer to them in the call to the macro.
You would be better off just copying the text twice or using another line of code in the calling program to create a macro variable.
%let name=vent7w2011May ;
%ventilator(dset=&name, itb_extb=intext.combined&name);
You cannot refer to the value of local macro variables (all macro parameters are local to the macro) outside of the macro. So you cannot refer to them in the call to the macro.
You would be better off just copying the text twice or using another line of code in the calling program to create a macro variable.
%let name=vent7w2011May ;
%ventilator(dset=&name, itb_extb=intext.combined&name);
Hi Tom,
Could you clarify this a little bit for me...
the dset changes for every call of the macro so I cannot put it in the %let as well??????
Do you have a list of data sets to process?
Hi Thanks for the reply I think I got it..
But could you tell me how can I use Set statement to acheive this same thing??
This is inside of a macro and each time you call a macro the results I get I want to append to the previous
Thanks
proc append base=intext.final_all data=intext.&itb_extb;
run;
proc append base=intext.final_all data=intext.&itb_extb;
run;
Says to append the records from intext.&itb_extb to the end of intext.final_all.
You can do the same with a data step like:
data intext.&itb_extb ;
set intext.&itb_extb intext.final_all ;
run;
i have a little confusion here
would it not be :
data intext.final_all ;
set intext.final_all intext.&itb_extb ;
run;
Does it matter at all?either way works??
Thanks
Doesn't really matter. The only difference would be order of the records in the table.
The disadvantage of using this method is that as the FINAL_ALL table grows this step will get slower and slower as it has to keep copy over all of the previous records. The discussion before about placing the names into a macro variable or list of macro variables and then looping over the macro variables to generate a single SET statement that listed all of the datasets would execute faster. But it depends on the size of the tables whether the difference is significant for your application.
But Tom
in the example below
for the first call this is OK
In the second call intext.&itb_extb changes and intext.final_all has nothing prior
So we will be having the contents of only the dataset in the second call???
Please correct me
In the end we will have only the records from the last dataset???
data intext.&itb_extb ;
set intext.&itb_extb intext.final_all ;
run;
You are right. I reversed the BASE and DATA table names. The order in the SET statement doesn't matter very much, but which one is specified in the DATA statement is critical.
Thanks Tom for the clarification..
Regards
So, Instead of
data intext.final_all ;
set intext.final_all intext.&itb_extb;
run;
YOU PUT
data intext.&itb_extb ;
set intext.&itb_extb intext.final_all ;
run;
In both of these the first one is to be followed right???
Hi,
I tried to use it and either of the cases it says:
intext.final_all ; doesnot exist??????
Please let me know how to deal with this???
Thanks
In any of these accumulation type programs you need to "prime the pump" in some way. That is one of the advantages of using PROC APPEND as it is happy to handle the case when the BASE dataset does not already exist.
One way to deal with it is to add some logic to your macro. Such as by making the inclusion of the final dataset conditional on it already existing as in the code fragment below.
data intext.final_all ;
set
%if exist(intext.final_all) %then intext.final_all ;
intext.&itb_extb ;
run;
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.