i want to print the variable names based on alphabetical order..
can you suggest any one????
thanks..
Here is one way:
proc sql noprint;
select name
into :reorder
separated by ' '
from dictionary.columns
where libname="SASHELP" and
memname="CLASS"
order by name
;
quit;
proc print data=sashelp.class;
var &reorder.;
run;
Here is one way:
proc sql noprint;
select name
into :reorder
separated by ' '
from dictionary.columns
where libname="SASHELP" and
memname="CLASS"
order by name
;
quit;
proc print data=sashelp.class;
var &reorder.;
run;
Thank you art297 for quick reply..
i found another way..
proc contents data=sashelp.class out=class1(keep=name);
run;
proc sql;
select name into:names separated by '' from class1;
quit;
data final;
retain &names;
set sashelp.class;
run;
I'm sure there are additional ways. I like the one I proposed as it requires less steps then the method you found.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.