BookmarkSubscribeRSS Feed
avigdo
Fluorite | Level 6

Hi,

I'm trying to use a macro variable (a date) in the filter, but I get an error. (Error 22-232)

That is what i'm typing - &start_of_month.

That variable is declared previously in a Program at the beginning of the  Process Flow.

Unfortunately, i cant attach printscreen due to Data security policy.

Is there a way to prevent that Error?

4 REPLIES 4
Reeza
Super User

The error text usually helps.

Guess off the cuff is that it's a type mismatch.

Ie your macro variable is 01June2013 and SAS is expecting a date literal instead, ie "01June2013"d

avigdo
Fluorite | Level 6

TNX, so what do you advise me to do?


in the log, just before the red error message, the variable appears like that DATE'2014-02-01'

do i need to CAST that field?

Reeza
Super User

You've marked your question as answered so I assume your problem is resolved.

BKST_merlin
Calcite | Level 5

Try this:

%let start_of_month=01Jun2013;

Data test;

   Format date date9.;

     date="&start_of_month."d

   put date;

run;

I believe that you didn't enclose the macro reference variable in either single or double quotes so you can define it as a date variable. 

sas-innovate-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

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