DATA Step, Macro, Functions and more

Required output for macro

Reply
N/A
Posts: 0

Required output for macro

hi i have one query
%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
SAS Employee
Posts: 105

Re: Required output for macro

If you have only 3 macro parameters you can do :

options symbolgen;
%let a=23;
%let b=45;
%let C=89;
data a;
x=&a;
output;
x=&b;
output;
x=&c;
output;
run;
Respected Advisor
Posts: 3,892

Re: Required output for macro

Hi yonib
As I understand it sas@kumar asked for the names of the macro vars and not their values.
Cheers, Patrick
N/A
Posts: 0

Re: Required output for macro

yes patrick............u r right.........can u help me with example?
Respected Advisor
Posts: 3,892

Re: Required output for macro

proc sql;
select *
from dictionary.macros;
quit;

OR:
proc print data=sashelp.vsmacro;
run;

And to get what you asked for:

proc sql;
create table MyTable as
select name as x
from dictionary.macros;
quit;

OR:
data MyTable;
set sashelp.vsmacro(keep=name);
rename name=x;
run;


Have a look at the link I've sent already: There you see the names and description of the fields in the dictionary table. sashelp.vsmacro is a view on dictionary.macros. Using PC SAS or SAS EG you can also browse sashelp.vsmacro

HTH
Patrick
N/A
Posts: 0

Re: Required output for macro

hi patrick,

data test1;
input id y x1 x2 x3;
cards;
01 1 13 14 15
02 1 33 44 55
03 0 44 55 66
04 1 55 66 77
05 0 66 77 88
06 0 77 88 99
07 1 88 99 11
08 1 22 33 44
09 0 32 43 54
10 0 22 33 44
11 1 32 43 54
;
run;

this is my data set, now my output should be in the form of data set shown below:

x
-----------
y
x1
x2
x3

so what is the syntax?

thanks]

kumar
Super User
Posts: 5,256

Re: Required output for macro

Do you want to putput the name of your columns?
PROC CONTENTS or PROC DATASETS may be used for that.

I also suggest that take a couple of training classes, since most of your questions concern basic programming concepts in SAS.

Regards,
Linus
Data never sleeps
N/A
Posts: 0

Re: Required output for macro

hi ............i dont require the values of that variables ..........i need the variable names itself
Respected Advisor
Posts: 3,892

Re: Required output for macro

Not sure what you're after but you can always query dictionary.macros (or sashelp.vmacro).
http://www.codecraftersinc.com/pdf/DictionaryTablesRefCard.pdf

HTH
Patrick
SAS Employee
Posts: 105

Re: Required output for macro

Yes Patrick ,my bad
Soo the query dictionary.macros will do job......
Ask a Question
Discussion stats
  • 9 replies
  • 246 views
  • 0 likes
  • 4 in conversation