- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Posted 06-08-2010 01:28 AM
(1365 views)
Hi All.
I am trying to introduce a new macro variable in a data step and use that variable with in the same data step,is that possible?
I know that CALL SYMPUT will not work to acheive what I am trying to do.
If you have any suggestions,please let me know.
Thanks in advance.
I am trying to introduce a new macro variable in a data step and use that variable with in the same data step,is that possible?
I know that CALL SYMPUT will not work to acheive what I am trying to do.
If you have any suggestions,please let me know.
Thanks in advance.
4 REPLIES 4
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
No. you cant create and use a macro variable with in the same data step.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
The SYMPUT routine assigns the value of the macro variable during DATA step execution, but the macro variable references resolve during the compilation of a step or global statement. So you can’t retrieve the macro variable’s value in the same DATA step in which the SYMPUT routine assigns that value.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Instead of a macro variable you could use a retain statement to keep a value of a variable across iterations of the data step.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
While it actually is technically possible to create and then use a macro variable within the same DATA step, it is rarely the right solution. We would need to see more of the problem to address the design issues.