BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Solly7
Pyrite | Level 9

Hi, I need help in creating/adding a new column onto an existing data..I need to add new column and rename it as 'notes', then rename all the column values as 'Baseline' under 'notes' column

 

Data Have ( Table name = financial_transactions)

policy_no    Amount

1                 100

2                 200

3                 300

4                 400

 

      Data Want

policy_no    Amount    Notes

1                 100           baseline

2                 200           baseline

3                 300           baseline

4                 400           baseline

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
PeterClemmensen
Tourmaline | Level 20

Like this?

 

data have;
input policy_no Amount;
datalines;
1 100
2 200
3 300
4 400
;

data want;
   set have;
   retain notes 'baseline';
run;

View solution in original post

4 REPLIES 4
PeterClemmensen
Tourmaline | Level 20

Like this?

 

data have;
input policy_no Amount;
datalines;
1 100
2 200
3 300
4 400
;

data want;
   set have;
   retain notes 'baseline';
run;
Solly7
Pyrite | Level 9

Absolutely perfect..its working as expected. thank you very much

gamotte
Rhodochrosite | Level 12

Hello,

 

Are you sure you need to do that ? If your dataset is big, you will use a lot of additional storage space for very few information (no observation specific information).

 

Maybe, you could just use a macrovariable :
%let notes=baseline;

 

Or, if you have different datasets with distinct notes, you can create
a dataset which associates dataset names to their corresponding notes.

 

data notes;
input dsname $ notes $;
cards;
have baseline
... ; run;

What will this new column eventually be used for ?

sas-innovate-wordmark-2025-midnight.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


Register now!

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 761 views
  • 1 like
  • 3 in conversation