Desktop productivity for business analysts and programmers

Dataset-New Column Position

Reply
N/A
Posts: 0

Dataset-New Column Position

Occasionally I need to add a column to a dataset. The new column always becomes the first column. How can I control it so the column is added after the last column.
Ex:
data rfa;
format b_flag ;
label b_flag = 'Flag';
if (eFlag or cFlag) then b_flag = 1;
else b_flag=0;
run;
Super Contributor
Posts: 260

Re: Dataset-New Column Position

The trick is to type your first statement about your new variable (either FORMAT, LABEL or the variable's formula) AFTER the reading (SET or MERGE) statement ; then your variable is added at the far right of the dataset.
If you type at least one of the statements mentionning the new variable before the reading statement, it will be created at the left of the dataset.

Regards.
Olivier
Ask a Question
Discussion stats
  • 1 reply
  • 102 views
  • 0 likes
  • 2 in conversation