BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
Gick
Pyrite | Level 9

Hi,

 

I have a database. I want to create a macro-variable listing all the columns in my database.

I tried to do an sql proc. it does not work.

 

Result : %put &var_list.

Nom sexe classe_age Pond organe

TableSAS.PNG

data BDD_recod;
  input Nom $ sexe $ classe_age $ Pond organe;
  datalines;
Jean Masculin 0-4ans 10572.50 21
Marie Feminin 5-14ans 10572.50 2
Pierre Masculin 15-24ans 10572.5 0
J Feminin 0-4ans 10572.50 7
M Feminin 5-14ans 10572.50 6
Pe Masculin 0-4ans 10572.50 90
Je Masculin 15-24ans 10572.50 32
Ma Masculin 0-4ans 10572.50 2  
Pire Feminin 25-30ans 10572.5 10
Mfir Feminin 35-40ans 10572.50 2.1
Pell Masculin 40-45ans 10572.50 4.53
Jeurs Masculin 15-24ans 10572.50 8
Mam Masculin 0-4ans 10572.50 56   
Piress Feminin 15-24ans 10572.5 21.30
;
/*I tried this code*/
proc sql noprint;
  select name into :var_list separated by ' '
  from dictionary.columns
  where libname = 'WORK' and memname = 'BDD_recod';
quit;

%put &var_list; 

Can someone help me please.

Thanking you in advance.
Gick.

1 ACCEPTED SOLUTION
1 REPLY 1

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—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
  • 1 reply
  • 1942 views
  • 0 likes
  • 2 in conversation