need to suppress warning Apparent symbolic reference when i use :var9999

Reply
Occasional Contributor
Posts: 12

need to suppress warning Apparent symbolic reference when i use :var9999

In aetox varaible i had distinct values as mild,moderate and death

 

proc sql ;
select distinct(AETOXGRC) into :var1-:var9999
from ae;
quit;

%put &var1-&var9999;

 

when i call we get " WARNING: Apparent symbolic reference VAR9999 not resolved." need to supress this warning is there any option in sas ,why &var9999 because when there update to varaible this consider with out changing
code

Super User
Posts: 5,511

Re: need to suppress warning Apparent symbolic reference when i use :var9999

[ Edited ]
Posted in reply to ettinenivarma

You're getting the message when fewer than 9999 macro variables were needed to hold the result.  Worth a try:

 

%put &var1-&&var&sqlobs;

 

Update:  While I verified that this code works, your intent may be different.  It is conceivable that you are looking to write out the value of all macro variables created here.  (We really didn't discuss the intent of your program, only how to eliminate a warning.)  If that's the case, this is simple but prints extra information:

 

%put _user_;

 

For a cleaner version, you would need to add this code.  Assuming you are working within a macro definition so that %DO is permissible:

 

%do i = 1 %to &sqlobs;

   %put var&i = &&var&i;

%end;

Occasional Contributor
Posts: 12

Re: need to suppress warning Apparent symbolic reference when i use :var9999

Posted in reply to Astounding

 

This works:-


proc sql ;
select distinct(AETOXGRC) into :var1-:var9999
from ae;
quit;

%let varcount = &Sqlobs;

%put &&var&varcount;
%macro putit;
%do i=1 %to &sqlobs;
%put var&i = &&var&i;
%end;
%mend putit;
%putit

 

Thanks for your time,The challenge will come when we call seperate (&var1,&var2...) macro varaible  for other calculation again we need to check data , i will try standize this as well... thanks alot

Super User
Posts: 7,809

Re: need to suppress warning Apparent symbolic reference when i use :var9999

Posted in reply to ettinenivarma

There will only be macrovars created for the distinct values. If you only have 3 distinct values in the dataset (as indicated), only three macro vars will be there after the step.

 

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Occasional Contributor
Posts: 12

Re: need to suppress warning Apparent symbolic reference when i use :var9999

Posted in reply to KurtBremser

@KurtBremser@Yes ur correct, but when I call macro I need to suppress warning.

Super User
Posts: 11,343

Re: need to suppress warning Apparent symbolic reference when i use :var9999

Posted in reply to ettinenivarma

ettinenivarma wrote:

@KurtBremser@Yes ur correct, but when I call macro I need to suppress warning.


Then do not reference a variable you that you do not know exists.

When you run:

proc sql ;
select distinct(AETOXGRC) into :var1-:var9999
from ae;
quit;

an automatic macro variable SQLOBS is assigned to the number of output observations in Proc SQL (or macro vars in this case).

So capture that for reuse (as the sqlobs will reset for every Proc SQL call)

%let varcount = &Sqlobs;

 

And instead of &var9999 use &&var&varcount;

 

 

Occasional Contributor
Posts: 12

Re: need to suppress warning Apparent symbolic reference when i use :var9999

Thanks for response , when we use &&var&varcount; we get  Severe that is last value but in dataset we have 3 unique macrovaribles all these three need to store in your macro varaible.

 

I am trying create a macro varaible which should contain all unique values  , For example if in var1- mild var2-moderate v3-severe but i want to use :var9999 because when there is update to my data i should not change my macro varaible to var4 etc....

 

Thanks for your help

Ask a Question
Discussion stats
  • 6 replies
  • 180 views
  • 3 likes
  • 4 in conversation