BookmarkSubscribeRSS Feed
deleted_user
Not applicable
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
9 REPLIES 9
yonib
SAS Employee
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;
Patrick
Opal | Level 21
Hi yonib
As I understand it sas@kumar asked for the names of the macro vars and not their values.
Cheers, Patrick
deleted_user
Not applicable
yes patrick............u r right.........can u help me with example?
Patrick
Opal | Level 21
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
deleted_user
Not applicable
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
LinusH
Tourmaline | Level 20
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
deleted_user
Not applicable
hi ............i dont require the values of that variables ..........i need the variable names itself
Patrick
Opal | Level 21
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
yonib
SAS Employee
Yes Patrick ,my bad
Soo the query dictionary.macros will do job......

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 9 replies
  • 1437 views
  • 0 likes
  • 4 in conversation