Help using Base SAS procedures

Required output for macro

Reply
N/A
Posts: 0

Required output for macro

%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
Super User
Posts: 5,431

Re: Required output for macro

Posted in reply to deleted_user
%put &A; etc.

See on-line doc for macro processing.

/Linus
Data never sleeps
N/A
Posts: 0

Re: Required output for macro

%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
Super User
Posts: 5,431

Re: Required output for macro

Posted in reply to deleted_user
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
SAS Super FREQ
Posts: 8,868

Re: Required output for macro

Posted in reply to deleted_user
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]
N/A
Posts: 0

Re: Required output for macro

Posted in reply to Cynthia_sas
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
Respected Advisor
Posts: 4,173

Re: Required output for macro

Posted in reply to deleted_user
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
Ask a Question
Discussion stats
  • 6 replies
  • 126 views
  • 0 likes
  • 4 in conversation