dm "log; clear; odsresults; clear;"; options linesize=64 nonumber nodate; options mprint symbolgen mlogic; *********************************************************************; * AUTHOR: Chris Bilder *; * DATE: 7-7-16 *; * PURPOSE: Illustrate pre-defined macro functions *; *********************************************************************; title1 "Chris Bilder, STAT 850"; *********************************************************************; * %let; %let newtitle = My title; %let x1 = year; *Current day/time; data time; time = hour(time()); minute = minute(time()); second = second(time()); month = month(today()); day = day(today()); year = year(today()); run; title1 "&newtitle"; title2 "What time is it?"; proc print data=time; run; title1 "&newtitle"; title2 "What year is it?"; proc print data=time; var &x1; run; ************************************************************************; * %put and %eval; %let x2 = 1; %put &x2; %put Go Big Red!; %let x3 = 1 + &x2; %put &x3; %put %eval(&x3); %put %eval(&x3 + 0.1); *Does not work; %put %sysevalf(&x3 + 0.1); ************************************************************************; * %include; %include "C:\chris\unl\Dropbox\NEW\STAT850\SAS\Introduction\cereal.sas"; ************************************************************************; * Find current day/time; title1 "Chris Bilder, STAT 850"; %macro time(title); data time; time = hour(time()); minute = minute(time()); second = second(time()); month = month(today()); day = day(today()); year = year(today()); run; title2 "&title"; proc print data=time; run; %mend time; %time(This part of my program ended at:) ************************************************************************; * Show how to create a macro variable from within a datastep; *This data set will not exist; data _null_; set time; call symput("hour", time); call symput("minute", minute); call symput("second", second); run; %put &hour &minute &second;