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

Hi.

i have a variable named "((Branch_Nbr||' - ')||Branch_Cus" in a dataset  .

How can i change its name to "aaa" using the rename statement in datastep?

Thanks

Rafael

15         data Custs_Numerators_Income;

16              options obs=500;

17              set work.Custs_Numerators_Income

18              (

19                   rename=( "((Branch_Nbr||' - ')||Branch_Cus" = aaa )

                      __________________________________

                      214

                      23

ERROR 214-322: Variable name "((Branch_Nbr||' - ')||Branch_Cus" is not valid.

ERROR 23-7: Invalid value for the RENAME option.

20              );

21       

22              FORMAT Customer_Profit_Date DDMMYYS10.;

23              FORMAT Branch_Cust_End_Date DDMMYYS10.;

24       

25              /* rename ((Branch_Nbr||' - ')||Branch_Cus=aaa; */

26       

27                 

28       

29       

30       

31         run;

NOTE: The SAS System stopped processing this step because of errors.

WARNING: The data set WORK.CUSTS_NUMERATORS_INCOME may be incomplete.  When this step was stopped there were 0 observations and 2

         variables.

WARNING: Data set WORK.CUSTS_NUMERATORS_INCOME was not replaced because this step was stopped.

NOTE: DATA statement used (Total process time):

      real time           0.00 seconds

      cpu time            0.00 seconds

1 ACCEPTED SOLUTION

Accepted Solutions
Ksharp
Super User

If that is real variable name .Try to Add N at then end of it .

options validvarname=any;

data Custs_Numerators_Income;

              options obs=500;

             set work.Custs_Numerators_Income

             (

                  rename=( "((Branch_Nbr||' - ')||Branch_Cus"N = aaa )

View solution in original post

3 REPLIES 3
RW9
Diamond | Level 26 RW9
Diamond | Level 26

Hi

((Branch_Nbr||' - ')||Branch_Cus

Is not a valid variable name in SAS.  Do you mean you have a variable which has a label like the above?  If the variable is named that (and how?) then you might need:

options validvarname=any;


however more likely is that your talking about the label, in which case:

data want;

     set have;

     label variable "aaa";

run;

Ksharp
Super User

If that is real variable name .Try to Add N at then end of it .

options validvarname=any;

data Custs_Numerators_Income;

              options obs=500;

             set work.Custs_Numerators_Income

             (

                  rename=( "((Branch_Nbr||' - ')||Branch_Cus"N = aaa )

RafaelZ
Calcite | Level 5

Hi xia

Thank you very much.

That solved it

Thanks again

Rafael

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 3 replies
  • 8142 views
  • 0 likes
  • 3 in conversation