As the first step in the decommissioning of sasCommunity.org the site has been converted to read-only mode.


Here are some tips for How to share your SAS knowledge with your professional network.


Difference between revisions of "Tip of the Day:August 17"

From sasCommunity
Jump to: navigation, search
(New page: <table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td style="background-color: #E1F7E5;border-color: #18AF1F;border-width: 1px;border-style: solid;" width="48%" valign="...)
 
m (Scheduled SUM Statement and the Implied SUM Function)
Line 1: Line 1:
 
<table border="0" width="100%" cellspacing="0" cellpadding="0">
 
<table border="0" width="100%" cellspacing="0" cellpadding="0">
 
<tr>
 
<tr>
<td style="background-color: #E1F7E5;border-color: #18AF1F;border-width: 1px;border-style: solid;" width="48%" valign="top" align="center">
+
<td style="background-color: #E1F7E5;border-color: #18AF1F;border-width: 1px;border-style: solid;" width="48%" valign="top">
 
<h1 style="background-color: #18AF1F;color: #FFFFFF; padding:10px">
 
<h1 style="background-color: #18AF1F;color: #FFFFFF; padding:10px">
 
sasCommunity Tip of the Day
 
sasCommunity Tip of the Day
 
</h1><div style="padding:10px;">
 
</h1><div style="padding:10px;">
{{Tips:Placeholder}}
+
{{Tips:SUM Statement and the Implied SUM Function}}
 
<div style="width:100%"><hr></div>
 
<div style="width:100%"><hr></div>
Feel free to [[Tips Talk:Placeholder|comment]] on this tip.
+
Feel free to [[Tips Talk:SUM Statement and the Implied SUM Function|comment]] on this tip.
 
</div>
 
</div>
 
</td></tr>
 
</td></tr>

Revision as of 11:31, 16 August 2009

sasCommunity Tip of the Day

The SUM statement uses an implied SUM function. The SUM statement:

cnt + expression;

has the implied syntax of:

cnt = sum(cnt, expression);

Thus the following will count the observations, even though the summation variable, CNT, has been initialized to missing.

 data new;
    set sashelp.class;
    if _n_=1 then cnt=.;
    cnt+1;
    run;

Submitted by Art Carpenter. Contact me at my Discussion Page.



Feel free to comment on this tip.


Prior tip - Next tip - Random Tip

Submit a Tip