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


Please Help Members By Posting Answers For Below Questions

what is business intelligence? : Sas-bi

583


Mention what is the difference between nodupkey and nodup options?

597


please can you tell me that in companies sas work are doing by through sas coding or sas wizard ??

1668


How to specify variables to be processed by the freq procedure?

619


how are numeric and character missing values represented internally? : Sas programming

622






What would you change about your job?

1929


What are the prime responsibilities of data integration administrator? : Sas-di

591


Why double trailing @@ is used in input statement?

705


how do you pull data from equifax?tell me the process?

1382


How to import multiple xls files into sas. Out of those files, how to get different values from a single variable and how to find number of rows per value type? We can do this using group by for one xls file with proc sql. Was wondering how I can achieve this for multiple files at the same time. Any ideas?

2387


what is the use of proc contents and proc print in sas? : Sas-administrator

606


what do you mean by data staging area? : Sas-di

606


what is treatment emergent events and treatment emregent adverse event

1945


What are the limitations for memory allocation for SAS variables

934


how would you determine the number of missing or nonmissing values in computations? : Sas programming

659