DATA Step, Macro, Functions and more

How do I export a value in a dataset as a macro value to add to a ods text?

Accepted Solution Solved
Reply
Contributor
Posts: 60
Accepted Solution

How do I export a value in a dataset as a macro value to add to a ods text?

[ Edited ]

 So basically i have a value (0.126) that I outputted using the out statement from a procedure. It's outputted into a dataset and looks pretty much like this right now:

 

data have;
infile datalines dsd;
input value label ~ $ 200. ;
datalines;
0.126,XXXX
;
run;

 

 Basically I want to use that 0.126 as a macro value, basically this is what I want:

 

%let value=0.126;

title "Blah blah blah value=&value"; ods rtf prepage="Blah blah blah value=&value";

 

Wanted Output from ODS text:

Blah blah blah value=0.126

The disconnect right now, I am unsure how to export the 0.126 into the macro variable value from a dataset, so I can use it in the ODS text above.

 

I have to do this multiple times for a lot of analyses, so I am trying to build this code somehow into my current macro.. I am unsure if it is possible?


Accepted Solutions
Solution
a month ago
Super User
Posts: 10,278

Re: How do I export a value in a dataset as a macro value to add to a ods text?

Use call symput().

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
How to convert datasets to data steps
How to post code

View solution in original post


All Replies
Solution
a month ago
Super User
Posts: 10,278

Re: How do I export a value in a dataset as a macro value to add to a ods text?

Use call symput().

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
How to convert datasets to data steps
How to post code
☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 1 reply
  • 70 views
  • 0 likes
  • 2 in conversation