BookmarkSubscribeRSS Feed
MABRINCH
Fluorite | Level 6
 

Can someone help me with a SAS code where a variable, MET, extract the numbers of the second variable, if one of the variables CODE_1-CODE_44 contains one of several codes (T1b, T4a, T3a) and that the first subsequent variable (of CODE_1-CODE_44) contains a 6-character code  that starts with "LND" (LND001-LND200).  

 

CODE_1  CODE_2 CODE_3 CODE_4       CODE_5        MET.1  MET.2 

T1b             LND022     C2a         P4                T6B               22        .           

T4a             M4            C2a         T4a              LND020          20        .              

T4a             LND001     T1b         LND044       LND032          1        44       

1 REPLY 1
andreas_lds
Jade | Level 19

Please post data in usable from (data step with datalines) and the expected result.

It is not clear what you want to create, maybe the MET-variables?

If that is the case, using compress to remove non-digits and input to create numbers seem to be a good choice.

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 698 views
  • 0 likes
  • 2 in conversation