Hi,
I have two data sets.
First data set contains two variables ID and Description
Second data set has variables with observations that contains numbers. These numbers are corelated with ID numbers from the first data set.
Now my task is to change this numbers from the second data sets to the description from the first set . I've tried with joins but this is not efficient and takes a lot of time. Any ideas ?
first data set
ID Description
14 yellow
second data set
Color
14
e.g.:
data descriptions; input ID Description $50.; cards; 14 yellow ; data have; input Color; cards; 14 ; data for4mat; set descriptions (rename=(id=start description=label)) end = last; retain fmtname 'ccode' type 'N'; run; proc format cntlin = for4mat; run; data want; set have; length Color_Description $50.; Color_Description=put(color,ccode.); run;
Art, CEO, AnalystFinder.com
I'd create and apply a format.
Art, CEO, AnalystFinder.com
e.g.:
data descriptions; input ID Description $50.; cards; 14 yellow ; data have; input Color; cards; 14 ; data for4mat; set descriptions (rename=(id=start description=label)) end = last; retain fmtname 'ccode' type 'N'; run; proc format cntlin = for4mat; run; data want; set have; length Color_Description $50.; Color_Description=put(color,ccode.); run;
Art, CEO, AnalystFinder.com
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.