BookmarkSubscribeRSS Feed
ren2010
Obsidian | Level 7
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.
4 REPLIES 4
dhana
Fluorite | Level 6
No. you cant create and use a macro variable with in the same data step.
dhana
Fluorite | Level 6
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.
RickM
Fluorite | Level 6
Instead of a macro variable you could use a retain statement to keep a value of a variable across iterations of the data step.
ArtC
Rhodochrosite | Level 12
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.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 937 views
  • 0 likes
  • 4 in conversation