BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
varunk
Calcite | Level 5

Hi Experts,

 

When i submitt the below statements it gets resolved to February.

 

%let %SYSFUNC(TODAY(), Monname.);

Resolves to February

 

However when i try to provide date value manually below statement gives error, Could you please let me know why it is giving error and how can it be resolved.


%Let D=%EVAL("24FEB2016"d);

%PUT %SYSFUNC(&D,Monname.);

 

Thanks in advance.

 

Regards,

Varun

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

%sysfunc requires a function in the first parameter and an optional format for the second parameter.

 

You're not using a function for the first parameter. If you use PUTN then you don't need the second parameter.

This resolves as expected:

 

%Let D="24FEB2016"d;
%put %sysfunc(putn(&d, monname.));

View solution in original post

4 REPLIES 4
Reeza
Super User

%sysfunc requires a function in the first parameter and an optional format for the second parameter.

 

You're not using a function for the first parameter. If you use PUTN then you don't need the second parameter.

This resolves as expected:

 

%Let D="24FEB2016"d;
%put %sysfunc(putn(&d, monname.));
FreelanceReinh
Jade | Level 19

Hi @varunk,

 

The first error message ("A character operand was found in the %EVAL function ...") is due to the fact that %EVAL cannot cope with date literals. To store the numeric SAS date value corresponding to the date literal in the macro variable, you can use the %SYSEVALF function:

%let d=%sysevalf("24FEB2016"d);
%put &d;
/* 20508 */

Reeza explained the second error message ("Function name missing in %SYSFUNC ...").

varunk
Calcite | Level 5

thanks for all your help.

varunk
Calcite | Level 5

Thanks for all your help

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 1236 views
  • 0 likes
  • 3 in conversation