What is difference between rename and lable in sas?
Answer Posted / gopi
1) rename can be used as statement or dataset option to
change the name of variable.
2) label, if used as a statement it changes or assigns label
to a variable and if used as a dataset option it changes or
assigns label to the dataset.
Reaname:
a) If you use rename data set option for input dataset, then
SAS renames the variable name in Input dataset.
Data new;
x=1;
y=2;
run;
Data ren ;
set new(rename=(x=z));
run;
This will create ren dataset with z and y variables, and you
can use z varible in the same data step if you want to do
any calculations.
b) If you use rename data set option for output dataset,
then SAS renames the variable in output dataset.
Data new;
x=1;
y=2;
run;
Data ren (rename=(x=z));
set new;
run;
This will create ren dataset with z and y variables, and you
can not use z varible in the same data step if you want to
do any calculations.
3)You can use Rename as statement also, in which case it
effects only output dataset. i.e you can not use the renamed
variable in same data step in calculations
Label:
a) If you use label statement in data step, it assigns or
changes the label name for a variable permanently.
b) If you use label statement in proc step, it assigns or
changes the lable name for a variable temporarily for that
proc step.
c) If you use label as dataset option it assigns label to
the dataset, but not the variable.
| Is This Answer Correct ? | 3 Yes | 2 No |
Post New Answer View All Answers
What is the difference between %local and %global? : sas-macro
How long can a macro variable be? A token? : sas-macro
How do dates work in SAS data?
what is PhaseIII, ODS, TLG, Macro and Proc in SAS
Is the physical structure of the data set in the same orientation as the report? Do you need to reshape the data sets? What method should you use to reshape the data–DATA steps,PROC TRANSPOSE,output data set from a procedure?
Hi Jeevan/Akshara I have tried to contact SASI Vats for latest Advanced SAS Programming Certification Dumps (A00-212) but have not got any response. I would highly and gratefully appreciate your assistance in this regard. If you guys have access to this, would you be kind enough to forward it to me ? I would abide by all the terms you have for this. Please, note my email id: upretigopi@yahoo.com Preti Sharma
What is the sas data set? : sas-grid-administration
do you prefer proc report or proc tabulate? Why? : Sas programming
What are the best sas programming practices for handling very large datasets? : sas-grid-administration
What are the different versions of sas that you have used until now? : sas-grid-administration
Will it bother you if the guy at the next desk times the frequency and duration of your bathroom or coffee breaks on the grounds that ?you are getting paid twice as much as he is??
which date function advances a date, time or datetime value by a given interval? : Sas programming
What is the maximum and minimum length of macro variable
Describe the ways in which you can create macro variables? : sas-macro
what is enterprise guide? What is the use of it? : Sas programming