Hi All,
I have an imported dataset (from a text file) and added only one column to the table / dataset called "Data_Source". The position of the added column is Last. How can I move it to First?
Columns Order IS:
A B C D Data_Source
Column Order Desired:
Data_Source A B C D
Many Thanks
hEllo,
how have you added the column ? If you have used a data step than you can put it in the first position by simply naming it before the set statement. For example:
data want;
length a $ 15;
set sashelp.class;
a='z'||name;
run;
Here is my code to add the new column, not in the text file that was imported.
/* Add Field */
proc sql;
alter table work.Loan_Detail_&i.
add Data_Source CHAR(35);
run;
I found some code that works. Not sure how it works but it move my columns to the front.
/* Change Order of Fields*/
data work.ALL_MONTHS_LOAN_DETAIL;
retain Source_Date Data_Source;
set ALL_MONTHS_LOAN_DETAIL;
run;
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 lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.
Ready to level-up your skills? Choose your own adventure.