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.
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!
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.