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
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.