- "The query requires remerging summary statistics back with the original data"
- "Numeric values have been converted to character values"
- "Character values have been converted to numeric values"
data _null_;
today=today();
call symput('today',today);
run;
%put NOTE: Today is &today;
today=today();
call symput('today',today);
run;
%put NOTE: Today is &today;
The example sets today's date as a macro variable called today. However, the output is just a number. Depending on how the macro variable is used, this may be okay. Here's a better way to write it:
data _null_;
today=today();
call symput('today',compress(put(today,8.)));
run;
%put NOTE: The date value of today is &today;
today=today();
call symput('today',compress(put(today,8.)));
run;
%put NOTE: The date value of today is &today;
Or, even simpler:
data _null_;
today=today();
call symputx('today',today);
run;
%put NOTE: The date value of today is &today;
today=today();
call symputx('today',today);
run;
%put NOTE: The date value of today is &today;
Adding the "x" to the call symput statement will automatically set the numeric variable to character and remove spaces.
If the programmer actually intends to write out the date in a date format, then the following code will work. (Note that the date format can be whatever format desired. I like the YYMMDDN8 format since it sorts better.)
data _null_;
today=today();
call symput('today',put(today,yymmddn8.));
run;
%put NOTE: Today is &today;
today=today();
call symput('today',put(today,yymmddn8.));
run;
%put NOTE: Today is &today;
The macro program I've written can identify these types of issues so they can be corrected. I've also recently discovered that other SAS users have created such log checking utilities, and they include more phrases that would indicate issues within various procedures that I do not use frequently. Once I have time to review these statements, I will include them in my program as well.
In addition to identifying these issues, I'm filtering out common issues that occur with the above keywords that are probably not associated with issues in the program. For example, a libname error from an autoexec program may not be an error for the program if it is not used. If it is used, there will be subsequent errors that would identify the issue.
This type of non-issue occurs at work frequently. We have a generic autoexec that runs when SAS is started, and it includes libnames that are located in directories I do not have the security rights to view. Therefore, every time I start SAS there are errors in the log. When I check the log for issues, I do not want these generic issues to appear.
How do you check for issues in a SAS program? Do you have a utility for doing so? What do you check for?