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
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Check out this tutorial series to learn how to build your own steps in SAS Studio.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.