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

 

Secure your spot at the must-attend AI and analytics event of 2024: SAS Innovate 2024! Get ready for a jam-packed agenda featuring workshops, super demos, breakout sessions, roundtables, inspiring keynotes and incredible networking events.

 

Register by March 1 to snag the Early Bird rate of just $695! Don't miss out on this exclusive offer. 

 

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
  • 1 reply
  • 202 views
  • 0 likes
  • 2 in conversation