BookmarkSubscribeRSS Feed
Pradeepbanu
Obsidian | Level 7

Hello Everyone,

 

My dataset columns looks like below

 

ID Name ORG_ID Products Var_1 Var_2 Var_3 Var_4 Var_5

 

I want to rename only the range lists which is Var_1--var_5, like

Var_1 = Current month ending date

Var_2= Prev month ending date....

 

My dataset would be like

ID Name ORG_ID Products 30Nov2020 31Oct2020  30Sep2020 .... so on

 

How can I achieve this?

 

2 REPLIES 2
Astounding
PROC Star

Did you know:

  • 30Nov2020 would normally be an invalid name for a variable.
  • That name can be used, but becomes very clumsy.  To program with it, you would need to refer to it as "30Nov2020"n

If you need different column headings, why not use variable labels instead of trying to change the variable names?

andreas_lds
Jade | Level 19

So you want data in variables names. This is, in almost any case i came across, a bad idea an will make further usage of the data unnecessary difficult. So i would start by transposing the data to something like ID / Name / ORG_ID / Products / Date / Value.

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
  • 2 replies
  • 523 views
  • 4 likes
  • 3 in conversation