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:October 18"

From sasCommunity
Jump to: navigation, search
m (Scheduled Easy Way to Research SAS System Requirements Across Computer Platforms and Operating Systems)
(Strip Blanks from PROC SQL-Created Macro Variable Values)
 
Line 5: Line 5:
 
sasCommunity Tip of the Day
 
sasCommunity Tip of the Day
 
</h1><div style="padding:10px;">
 
</h1><div style="padding:10px;">
{{Tips:Easy Way to Research SAS System Requirements Across Computer Platforms and Operating Systems}}
+
{{Tips:Strip Blanks from PROC SQL-Created Macro Variable Values}}
 
<div style="width:100%"><hr></div>
 
<div style="width:100%"><hr></div>
Feel free to [[Tips Talk:Easy Way to Research SAS System Requirements Across Computer Platforms and Operating Systems|comment]] on this tip.
+
Feel free to [[Tips Talk:Strip Blanks from PROC SQL-Created Macro Variable Values|comment]] on this tip.
 
</div>
 
</div>
 
</td></tr>
 
</td></tr>

Latest revision as of 19:28, 10 October 2011

sasCommunity Tip of the Day

A macro variable created in PROC SQL from a numeric variable or function has leading blanks...

proc sql;
    select count(*) into :howmany
    from sashelp.class;
quit;
%put |&howmany|;
 
|      19|

An easy way to get rid of the leading blanks is as follows...

proc sql;
    select count(*) into :howmany separated by ''
    from sashelp.class;
quit;
%put |&howmany|;
 
|19|

Posted with thanks to Robert Allison.

Since the original post, the TRIMMED option has been added to the INTO clause in PROC SQL. It will also strip blanks.

proc sql;
    select count(*) into :howmany trimmed
    from sashelp.class;
quit;
%put |&howmany|;
 
|19|


Submitted By Mike Zdeb



Feel free to comment on this tip.


Prior tip - Next tip - Random Tip

Submit a Tip