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-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 9 replies
  • 1002 views
  • 0 likes
  • 4 in conversation