BookmarkSubscribeRSS Feed
deleted_user
Not applicable
%let a=23;
%let b=45;
%let C=89;

by using %put statement the output should be in the form mentioned below.
what is the syntax for getting this output?

ex: 23
45
89
6 REPLIES 6
LinusH
Tourmaline | Level 20
%put &A; etc.

See on-line doc for macro processing.

/Linus
Data never sleeps
deleted_user
Not applicable
%let a=23;
%let b=45;
%let C=89;

by using %put statement the output should be in the form mentioned below.
what is the syntax for getting this output?

ex: 23
45
89


and this values should store in separate data set...........and that should be done by % put statement.........so is it possible
LinusH
Tourmaline | Level 20
I don't understand your situation here.
Where are your values stored initially?
How/where would you like them to be "outputted"? In a report, another table, or in the LOG? What functionality are you aiming for?

/Linus
Data never sleeps
Cynthia_sas
Diamond | Level 26
Hi:
Although I do not understand what you want to do, one part of your question is easy to answer. %PUT only writes to the SAS log. It does not function like the DATA step PUT statement where you can write to a fileref.

As for the rest of your question, you say that you want the values of &A, &B and &C stored in a data set? Where are they coming from in the first place? Are they constants? Why do you need macro variables?

cynthia

Consider the following program:

[pre]
data examp1;
a=23;
b=45;
c=89;
d = a + b + c;
method = "Direct";
run;

ods listing;
proc print data=examp1;
title 'Examp 1 -- Using Constants';
run;

%let a = 23;
%let b = 45;
%let c = 89;
%let method = Macro;

data examp2;
fred = &a;
ethel = &b;
ricky = &c;
lucy = %eval(&a + &b + &c);
method = "&method";
run;

ods listing;
proc print data=examp2;
title2 'Examp2 -- Using Macro Variables to Substitute for Constants';
run;[/pre]
deleted_user
Not applicable
hi i will make u clear now
%let a=23;
%let b=45;
%let C=89;

so now i need the output
x
-------------
a
b
c

where x is the variable..

abd a, b and c variable names should present in single column as shown above
Patrick
Opal | Level 21
Hi sas@kumar
please keep your posts in one forum only. It's a bit annoying to answer a question only to see later on that there was already quite a discussion going on in another forum.
Cheers, Patrick

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 6 replies
  • 1447 views
  • 0 likes
  • 4 in conversation