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
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 )
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;
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 )
Hi xia
Thank you very much.
That solved it
Thanks again
Rafael
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!
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.