Dear,
In my pgm, when i created variables d,e f, in data step two, I am seeing the variable labels for these variables. i need to carry labels of source variables. Please suggest
data one;
input a $ b $ c;
label a ='some' b='somm' c='somn';
datalines;
nn ss 1
dk mm 2
;
data two;
set one;
d=a;
e=b;
f=c;
run;
Create a data set with the names of the variables and labels from the starting set.
Add the matching new variable names to that data set.
Use the data set to write Proc Datasets code to modify data set 2 after creation to use the labels.
You can find some examples on the forum of using Call Execute in a data step to call Proc datasets to rename variables, label syntax would be similar using the New name and old label in a modify block.
data two;
merge
one
one (rename=(a=d b=e c=f))
;
run;
Hi @knveraraju91,
Another option:
proc sql;
create table two as
select *, a as d, b as e, c as f
from one;
quit;
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Select SAS Training centers are offering in-person courses. View upcoming courses for: