BookmarkSubscribeRSS Feed
deleted_user
Not applicable
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;
1 REPLY 1
Olivier
Pyrite | Level 9
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

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 587 views
  • 0 likes
  • 2 in conversation