BookmarkSubscribeRSS Feed
JohnT
Quartz | Level 8
Gday,

I have intentionally used variables which do not exist in a SUM function.

I want to remove the:
[pre]
NOTE: Variable var is uninitialized.
[/pre]

message in the log.

How do I suppress these messages?




[pre]
324 %put &var.;
si_AGFV, si_AIRC, si_AUTO, si_AVEQ, si_BLDG, si_BLDS, si_BUSI, si_CATL, si_CATR, si_CMOT, si_CNTS,
si_COMB, si_COMM, si_COMP, si_CONS, si_CONT, si_COOL, si_CTST, si_CWEQ, si_CWPL, si_DAIP, si_DEER,
si_DMHL, si_DMHM, si_DMHO, si_DMHW, si_DMHX, si_DOST, si_DSSR, si_DTRS, si_DWEL, si_EDDM, si_ELEM,
si_ESCA, si_EXGL, si_EXPE, si_EXPR, si_FABI, si_FBLD, si_FBPP, si_FCNT, si_FENC, si_FMMA, si_FPMT,
si_FREZ, si_FTRB, si_FWDG, si_GOAT, si_GRP1, si_GRP2, si_GRP3, si_HORS, si_HOTW, si_ICOW, si_ILSG,
si_INCM, si_INGL, si_LABT, si_LAPT, si_LIVF, si_LRBC, si_LREC, si_LSSR, si_MATI, si_MEDL, si_MIPR,
si_MITR, si_MOOD, si_MOTP, si_MSOF, si_OBRC, si_OFFC, si_OPDH, si_OPOH, si_OSPB, si_OSPM, si_OTHR,
si_PEEQ, si_PEQP, si_PIGO, si_PLBT, si_POUP, si_PREF, si_PRMO, si_PUPL, si_RBDT, si_RDEB, si_RDTA,
si_REFR, si_RENT, si_SCTY, si_SHEP, si_SNIT, si_SPDI, si_STCK, si_STCT, si_STEM, si_SUBP, si_SUPP,
si_TBCO, si_THFL, si_THFT, si_TLIQ, si_UNSP, si_WAGE
NOTE: This SAS session is using a registry in WORK. All changes will be lost at the end of this
session.
325
326
327 data gg;
328 si_bldg = 100;
329
330 gg = sum(&var.);
331 run;

NOTE: Variable si_AGFV is uninitialized.
NOTE: Variable si_AIRC is uninitialized.
NOTE: Variable si_AUTO is uninitialized.
NOTE: Variable si_AVEQ is uninitialized.
NOTE: Variable si_BLDS is uninitialized.
NOTE: Variable si_BUSI is uninitialized.
NOTE: Variable si_CATL is uninitialized.
NOTE: Variable si_CATR is uninitialized.
NOTE: Variable si_CMOT is uninitialized.
NOTE: Variable si_CNTS is uninitialized.
NOTE: Variable si_COMB is uninitialized.
NOTE: Variable si_COMM is uninitialized.
NOTE: Variable si_COMP is uninitialized.
NOTE: Variable si_CONS is uninitialized.
NOTE: Variable si_CONT is uninitialized.
NOTE: Variable si_COOL is uninitialized.
NOTE: Variable si_CTST is uninitialized.
NOTE: Variable si_CWEQ is uninitialized.
NOTE: Variable si_CWPL is uninitialized.
NOTE: Variable si_DAIP is uninitialized.
NOTE: Variable si_DEER is uninitialized.
NOTE: Variable si_DMHL is uninitialized.
NOTE: Variable si_DMHM is uninitialized.
NOTE: Variable si_DMHO is uninitialized.
NOTE: Variable si_DMHW is uninitialized.
NOTE: Variable si_DMHX is uninitialized.
NOTE: Variable si_DOST is uninitialized.
NOTE: Variable si_DSSR is uninitialized.
NOTE: Variable si_DTRS is uninitialized.
NOTE: Variable si_DWEL is uninitialized.
NOTE: Variable si_EDDM is uninitialized.
NOTE: Variable si_ELEM is uninitialized.
NOTE: Variable si_ESCA is uninitialized.
NOTE: Variable si_EXGL is uninitialized.
NOTE: Variable si_EXPE is uninitialized.
NOTE: Variable si_EXPR is uninitialized.
NOTE: Variable si_FABI is uninitialized.
NOTE: Variable si_FBLD is uninitialized.
NOTE: Variable si_FBPP is uninitialized.
NOTE: Variable si_FCNT is uninitialized.
NOTE: Variable si_FENC is uninitialized.
NOTE: Variable si_FMMA is uninitialized.
NOTE: Variable si_FPMT is uninitialized.
NOTE: Variable si_FREZ is uninitialized.
NOTE: Variable si_FTRB is uninitialized.
NOTE: Variable si_FWDG is uninitialized.
NOTE: Variable si_GOAT is uninitialized.
NOTE: Variable si_GRP1 is uninitialized.
NOTE: Variable si_GRP2 is uninitialized.
NOTE: Variable si_GRP3 is uninitialized.
NOTE: Variable si_HORS is uninitialized.
NOTE: Variable si_HOTW is uninitialized.
NOTE: Variable si_ICOW is uninitialized.
NOTE: Variable si_ILSG is uninitialized.
NOTE: Variable si_INCM is uninitialized.
NOTE: Variable si_INGL is uninitialized.
NOTE: Variable si_LABT is uninitialized.
NOTE: Variable si_LAPT is uninitialized.
NOTE: Variable si_LIVF is uninitialized.
NOTE: Variable si_LRBC is uninitialized.
NOTE: Variable si_LREC is uninitialized.
NOTE: Variable si_LSSR is uninitialized.
NOTE: Variable si_MATI is uninitialized.
NOTE: Variable si_MEDL is uninitialized.
NOTE: Variable si_MIPR is uninitialized.
NOTE: Variable si_MITR is uninitialized.
NOTE: Variable si_MOOD is uninitialized.
NOTE: Variable si_MOTP is uninitialized.
NOTE: Variable si_MSOF is uninitialized.
NOTE: Variable si_OBRC is uninitialized.
NOTE: Variable si_OFFC is uninitialized.
NOTE: Variable si_OPDH is uninitialized.
NOTE: Variable si_OPOH is uninitialized.
NOTE: Variable si_OSPB is uninitialized.
NOTE: Variable si_OSPM is uninitialized.
NOTE: Variable si_OTHR is uninitialized.
NOTE: Variable si_PEEQ is uninitialized.
NOTE: Variable si_PEQP is uninitialized.
NOTE: Variable si_PIGO is uninitialized.
NOTE: Variable si_PLBT is uninitialized.
NOTE: Variable si_POUP is uninitialized.
NOTE: Variable si_PREF is uninitialized.
NOTE: Variable si_PRMO is uninitialized.
NOTE: Variable si_PUPL is uninitialized.
NOTE: Variable si_RBDT is uninitialized.
NOTE: Variable si_RDEB is uninitialized.
NOTE: Variable si_RDTA is uninitialized.
NOTE: Variable si_REFR is uninitialized.
NOTE: Variable si_RENT is uninitialized.
NOTE: Variable si_SCTY is uninitialized.
NOTE: Variable si_SHEP is uninitialized.
NOTE: Variable si_SNIT is uninitialized.
NOTE: Variable si_SPDI is uninitialized.
NOTE: Variable si_STCK is uninitialized.
NOTE: Variable si_STCT is uninitialized.
NOTE: Variable si_STEM is uninitialized.
NOTE: Variable si_SUBP is uninitialized.
NOTE: Variable si_SUPP is uninitialized.
NOTE: Variable si_TBCO is uninitialized.
NOTE: Variable si_THFL is uninitialized.
NOTE: Variable si_THFT is uninitialized.
NOTE: Variable si_TLIQ is uninitialized.
NOTE: Variable si_UNSP is uninitialized.
NOTE: Variable si_WAGE is uninitialized.
NOTE: The data set WORK.GG has 1 observations and 106 variables.
NOTE: DATA statement used (Total process time):
real time 0.03 seconds
cpu time 0.00 seconds
[/pre]
^^
My log


Thanks
5 REPLIES 5
SASJedi
SAS Super FREQ
Try this:
data gg;
call missing(&var);
si_bldg = 100;
gg = sum(&var.);
run;
Check out my Jedi SAS Tricks for SAS Users
JohnT
Quartz | Level 8
Thanks SASJedi, that solves the question I was asking !!!

I need to improve my question making though.

I actually don't want the missing variables either. I'll think about it, but might just live with it.
Cynthia_sas
SAS Super FREQ
Hi:
I don't understand what you mean when you say: "I actually don't want missing variables either."

The default behavior for SAS is to make a "slot" in the Program Data Vector (PDV), at compile time, for every variable you reference in your program, whether it's missing or not. Then, at execution time, those slots in the PDV are filled with values for every iteration of the DATA step program (or set to missing).

Whether you receive or suppress the messages has nothing to do with the fact that the uninitialized variables will become part of the dataset, with missing values. You can see this in action with the basic code shown below.

cynthia
[pre]
data new;
newvar = sum(one, two, three);
run;

proc contents data=new;
run;

options nocenter;
proc print data=new;
run;
[/pre]

From the SAS LOG:
[pre]
1 data new;
2 newvar = sum(one, two, three);
3 run;

NOTE: Variable one is uninitialized.
NOTE: Variable two is uninitialized.
NOTE: Variable three is uninitialized.
NOTE: Missing values were generated as a result of performing an operation on missing values.
Each place is given by: (Number of times) at (Line):(Column).
1 at 2:12
NOTE: The data set WORK.NEW has 1 observations and 4 variables.
NOTE: DATA statement used (Total process time):
real time 0.03 seconds
cpu time 0.03 seconds
[/pre]

From PROC CONTENTS:
[pre]
The CONTENTS Procedure

Data Set Name WORK.NEW Observations 1
Member Type DATA Variables 4
...more PROC CONTENTS output...


Alphabetic List of Variables and Attributes

# Variable Type Len

1 newvar Num 8
2 one Num 8
4 three Num 8
3 two Num 8

[/pre]

From PROC PRINT:
[pre]
Obs newvar one two three

1 . . . .
[/pre]
Howles
Quartz | Level 8
This sort of makes sense if there is a mix of missing and non-missing values in the collection. Here's a kludge:

%let varlist = x y z ;
data _null_ ;
y = 11 ;
if 0 then call missing (of &varlist) ;
added_up = sum (of &varlist) ;
put added_up= ;
run ;

The CALL MISSING is predicated on a condition that's never true. That tricks the compiler, so the non-initialization notes do not appear, but of course the values are not touched at execution time.

> Thanks SASJedi, that solves the question I was asking
> !!!
>
> I need to improve my question making though.
>
> I actually don't want the missing variables either.
> I'll think about it, but might just live with it.
PatrickG
SAS Employee
You could just turn off all the notes with the 'nonotes' option...

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 5 replies
  • 4058 views
  • 0 likes
  • 5 in conversation