Hi,
I do not manage to get column names from my dataset using proc sql.
What's wrong in the following example code ?
data work.birthday;
input @01 employee_id 6.
@08 last_name $10.
@19 birthday date7.;
format employee_id 6.
last_name $10.
birthday date7.;
datalines;
1247 Garcia 04APR54
1078 Gibson 23APR36
1005 Knapp 06OCT38
1024 Mueller 17JUN53
;
proc print data=work.birthday;
title2 'SAS Data Set work.BIRTHDAY';
run;
proc sql;
select * into :charlist separated by ' '
from dictionary.columns
where libname="work" and memname="birthday"
;
quit;
Hi @ctisseuil,
And adding to @FreelanceReinh : The values for libname and memname are always uppercase
where libname="WORK" and memname="BIRTHDAY"
Do you want the full list of problems? Or just the problems with the part that is trying to gather variable names?
Let's start with the last step:
proc sql;
select * into :charlist separated by ' '
from dictionary.columns
where libname="work" and memname="birthday"
;
quit;
Issues:
proc sql noprint;
select nliteral(name)
into :charlist separated by ' '
from dictionary.columns
where libname="WORK" and memname="BIRTHDAY"
order by varnum
;
quit;
April 27 – 30 | Gaylord Texan | Grapevine, Texas
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 save with the early bird rate—just $795!
Check out this tutorial series to learn how to build your own steps in SAS Studio.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.