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
Explain how you can debug and test your SAS program?
Explain append procedure?
How can sas program be validated?
Give an example where SAS fails to convert character value to numeric value automatically?
name the scheduler for scheduling job and explain the scheduler? : Sas-di
Explain input and put function?
What is the difference between input and infile statement?
What is a put statement?
How would you include common or reuse to be processed along with your statements?
What are SAS/ACCESS and SAS/CONNECT?
what is sas application server, database server, sas olap server and sas metadata server? : Sas-di
Intern stastical programmer written test
Describe the function and untility of the most difficult SAS macro that you have written.
why is sas considered self-documenting? : Sas programming
Name types of category in which SAS Informats are placed?