%sysfunc

by Irina 22. May 2007 06:40

%sysfunc :

%sysfunc is useful for retrieving information about datasets, changing column attributes and formatting macro variables.One primary difference between calling a function in %SYSFUNC and elsewhere in the SAS System is this last notion of applying a format to the results of a function call.

Example1.

footnote finished: %sysfunc (today(), date9. );

Example2.

%put %sysfunc (PutN(&Salary,dollar12.));

Example3.

%put With a salary of
%sysfunc (PutN(&Salary,dollar12.));
%put You are %sysfunc(PutN(&salary, income.));

Example4.

If you wanted to find the total number of observations in a dataset and store that number as a macro variable. You might use something like this:

%let dsid= %sysfunc (open(name of the data));
%let nvars= %sysfunc (attrn(&dsid,nlobs));
%put &nvars; 
 

Tags: %sysfunc, macro

SAS | macro

Add comment


(will show your Gravatar icon)  





Live preview

7/30/2010 8:24:30 AM

 

About the author

Irina Spivak Irina Spivak
Team Leader at G-Stat. More...


Send mail Email

Authors

Blogroll

    Disclaimer

    The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

    © Copyright 2010

    Sign in

    eXTReMe Tracker