Convert a recode SAS script to R script

Hello everyone,

I'm seeking an easy way to convert this SAS script below to a R script. The script recodes FAP9PCX variable.

value  $FAP9PCx
"111a","111f","121a","121f","122a","131a","131f"        =   "A0Z00"
"111d","111e","121d","121e","131d","131e"               =   "A0Z01"
"122b"                                                  =   "A0Z02"
"100x","691e"                                           =   "A0Z40"
"691b"                                                  =   "A0Z41"
"533b","691f"                                           =   "A0Z42"
"691a"                                                  =   "A0Z43"
"111b","121b","131b"                                    =   "A1Z00"
"111c","121c","131c"                                    =   "A1Z01"
"691c"                                                  =   "A1Z40"
"631a"                                                  =   "A1Z41"
"691d"                                                  =   "A1Z42"
"471a","471b","480a"                                    =   "A2Z70"
"381a","381b","381c"                                    =   "A2Z90"
"122c"                                                  =   "A3Z00"
"692a"                                                  =   "A3Z40"
"656a","656b","656c"                                    =   "A3Z41"
"389c","480b"                                           =   "A3Z90"
"671a","671b","671c","671d"                             =   "B0Z20"
"681a"                                                  =   "B0Z21"
"211h","621a","621b","621d","621e","621f","621g"        =   "B1Z40"
"211a","632a"                                           =   "B2Z40"
"214d","632b"                                           =   "B2Z41"
"624d"                                                  =   "B2Z42"
"632c"                                                  =   "B2Z43"
"211c","632e"                                           =   "B2Z44"
"681b"                                                  =   "B3Z20"
"211d","632f"                                           =   "B4Z41"
"211b","632d","632j"                                    =   "B4Z42"
"211e","633a"                                           =   "B4Z43"
"211f","632g","632h"                                    =   "B4Z44"
"621c","651a"                                           =   "B5Z40"
"472b"                                                  =   "B6Z70"
"211j","472c","472d"                                    =   "B6Z71"
"472a"                                                  =   "B6Z72"
"481a","481b"                                           =   "B6Z73"
"312f","382b"                                           =   "B7Z90"
"382a","382c"                                           =   "B7Z91"
"672a"                                                  =   "C0Z20"
"622a","622b","622c","622d","622e","622f","622g"        =   "C1Z40"
"473b","473c"                                           =   "C2Z70"
"473a"                                                  =   "C2Z71"
"482a"                                                  =   "C2Z80"
"673a","673b"                                           =   "D0Z20"
"628c","628d"                                           =   "D1Z40"
"623f","623g"                                           =   "D1Z41"
"211g","212b","623a","634b"                             =   "D2Z40"
"623b"                                                  =   "D2Z41"
"623c","623d","623e"                                    =   "D2Z42"
"673c","682a"                                           =   "D3Z20"
"624a","624b","624c","624e","624g"                      =   "D4Z40"
"624f"                                                  =   "D4Z41"
"474b","474c"                                           =   "D6Z70"
"474a"                                                  =   "D6Z71"
"212c","212d","483a"                                    =   "D6Z80"
"674a"                                                  =   "E0Z20"
"674b","674c"                                           =   "E0Z21"
"674d"                                                  =   "E0Z22"
"674e"                                                  =   "E0Z23"
"676e"                                                  =   "E0Z24"
"625a","626a"                                           =   "E1Z40"
"625c"                                                  =   "E1Z41"
"625e","625f","625g"                                    =   "E1Z42"
"625h","626b","637a"                                    =   "E1Z43"
"626c"                                                  =   "E1Z44"
"479a","625b","628f"                                    =   "E1Z46"
"628g"                                                  =   "E1Z47"
"475a","475b","485a"                                    =   "E2Z70"
"484a","484b"                                           =   "E2Z80"
"675a"                                                  =   "F0Z20"
"627a","627b","627c"                                    =   "F1Z40"
"213a","635a"                                           =   "F1Z41"
"675b"                                                  =   "F2Z20"
"214a","214b"                                           =   "F3Z40"
"627d"                                                  =   "F3Z41"
"675c"                                                  =   "F4Z20"
"214c","627e","627f"                                    =   "F4Z41"
"476a","476b","485b"                                    =   "F5Z70"
"628a","634d"                                           =   "G0A40"
"628b","633d"                                           =   "G0A41"
"216c","633b"                                           =   "G0A42"
"632k"                                                  =   "G0A43"
"216b","634a"                                           =   "G0B40"
"212a","216a","633c","634c"                             =   "G0B41"
"477b","477c","477d","486a","486b","486c","486d"        =   "G1Z70"
"479b"                                                  =   "G1Z71"
"486e"                                                  =   "G1Z80"
"380a","383b","384b","385b","386d","386e"               =   "H0Z90"
"387e","387f"                                           =   "H0Z91"
"387c","387d"                                           =   "H0Z92"
"676a","676b","676c","676d"                             =   "J0Z20"
"652a","652b","653a"                                    =   "J1Z40"
"487a","487b"                                           =   "J1Z80"
"217a","526e","642a","642b"                             =   "J3Z40"
"641b"                                                  =   "J3Z41"
"643a","644a"                                           =   "J3Z42"
"217b","218a","641a"                                    =   "J3Z43"
"651b","654a","654b","654c"                             =   "J3Z44"
"655a"                                                  =   "J4Z40"
"546a"                                                  =   "J4Z60"
"466c","477a"                                           =   "J4Z80"
"546d","546e"                                           =   "J5Z60"
"546c"                                                  =   "J5Z61"
"546b"                                                  =   "J5Z62"
"226b","466a","466b"                                    =   "J5Z80"
"389a","451d"                                           =   "J6Z90"
"389b"                                                  =   "J6Z91"
"387b"                                                  =   "J6Z92"
"685a"                                                  =   "K0Z20"
"210x","214e","214f","217d","637b","637d"               =   "K0Z40"
"542a","542b"                                           =   "L0Z60"
"543a","543b","543c"                                    =   "L1Z60"
"313a","541a","541b","541c","541d"                      =   "L2Z60"
"543d","543e","543f","543g","543h"                      =   "L2Z61"
"461a","461b","461c"                                    =   "L3Z80"
"461e","461f"                                           =   "L4Z80"
"461d"                                                  =   "L4Z81"
"312c","312d","372a","372b","373a","373b","373c","373d" =   "L5Z90"
"372e"                                                  =   "L5Z91"
"372c","372d"                                           =   "L5Z92"
"232a","233a","233b","233c","233d"                      =   "L6Z00"
"231a","371a"                                           =   "L6Z90"
"544a"                                                  =   "M0Z60"
"478a"                                                  =   "M1Z80"
"478b","478c","478d"                                    =   "M1Z81"
"388a","388c"                                           =   "M2Z90"
"388b"                                                  =   "M2Z91"
"388e"                                                  =   "M2Z92"
"312e","383a","384a","385a","386a","386b","386c"        =   "N0Z90"
"342e","342f","342g","342h"                             =   "N0Z91"
"522a"                                                  =   "P0Z60"
"523a","523b","523c","523d","524a","524b","524c","524d" =   "P0Z61"
"533c"                                                  =   "P0Z61"
"521a","521b"                                           =   "P0Z62"
"451c"                                                  =   "P1Z80"
"451e","451f","451g","451h"                             =   "P1Z81"
"451a","451b"                                           =   "P1Z82"
"331a","332a","332b","333b","333e","333f","351a"        =   "P2Z90"
"333c","333d"                                           =   "P2Z91"
"334a"                                                  =   "P2Z92"
"312a","312b","312g"                                    =   "P3Z90"
"333a"                                                  =   "P3Z91"
"531a","531c","532a","532b","532c","533a"               =   "P4Z60"
"531b"                                                  =   "P4Z61"
"452a","452b"                                           =   "P4Z80"
"545a","545b","545c","545d"                             =   "Q0Z60"
"467a","467b"                                           =   "Q1Z80"
"467c","467d"                                           =   "Q1Z81"
"376a","376b","376c","376d"                             =   "Q2Z90"
"226a","376e","376f"                                    =   "Q2Z91"
"551a"                                                  =   "R0Z60"
"552a","554j"                                           =   "R0Z61"
"219a","554a"                                           =   "R1Z60"
"554b","554c"                                           =   "R1Z61"
"554d","554e","554f","554g"                             =   "R1Z62"
"556a"                                                  =   "R1Z63"
"553a","553b","553c","554h"                             =   "R1Z66"
"555a"                                                  =   "R1Z67"
"225a","463a","463b","463c","463d"                      =   "R2Z80"
"463e"                                                  =   "R2Z83"
"220x","222a","222b","223a","223b","223c","223d","223e" =   "R3Z80"
"223f","223g","223h","462a","462b","462d"               =   "R3Z80"
"221a","221b"                                           =   "R3Z81"
"462c","462e"                                           =   "R3Z82"
"374b","374c","374d"                                    =   "R4Z90"
"382d","383c","384c","385c","387a","388d"               =   "R4Z91"
"374a"                                                  =   "R4Z92"
"226c","376g"                                           =   "R4Z93"
"215d","683a"                                           =   "S0Z20"
"215b","625d","636a"                                    =   "S0Z40"
"215c","636b"                                           =   "S0Z41"
"215a","636c"                                           =   "S0Z42"
"561d"                                                  =   "S1Z20"
"636d"                                                  =   "S1Z40"
"488a"                                                  =   "S1Z80"
"561e","561f"                                           =   "S2Z60"
"561a","561b","561c"                                    =   "S2Z61"
"468a"                                                  =   "S2Z80"
"468b"                                                  =   "S2Z81"
"224a","224b","224c","224d"                             =   "S3Z00"
"377a","488b"                                           =   "S3Z90"
"217c","562a","562b"                                    =   "T0Z60"
"563c"                                                  =   "T1Z60"
"563b"                                                  =   "T2A60"
"563a"                                                  =   "T2B60"
"564a"                                                  =   "T3Z60"
"534a","534b"                                           =   "T3Z61"
"217e","525a","525b","525c","684a"                      =   "T4Z60"
"525d"                                                  =   "T4Z61"
"628e","684b"                                           =   "T4Z62"
"227c","227d","564b"                                    =   "T6Z61"
"464a"                                                  =   "U0Z80"
"464b"                                                  =   "U0Z81"
"375a","375b"                                           =   "U0Z90"
"372f","425a"                                           =   "U0Z91"
"352a","353a"                                           =   "U0Z92"
"353b","353c","465b","637c"                             =   "U1Z80"
"465c"                                                  =   "U1Z81"
"465a"                                                  =   "U1Z82"
"354b","354c","354d","354e","354f","354g"               =   "U1Z91"
"352b"                                                  =   "U1Z92"
"354a"                                                  =   "U1Z93"
"526a","526b","526c","526d"                             =   "V0Z60"
"431a","431b","431c","431d","431f","431g"               =   "V1Z80"
"431e"                                                  =   "V1Z81"
"311a","311b","344a","344b","344c"                      =   "V2Z90"
"311c"                                                  =   "V2Z91"
"311e"                                                  =   "V2Z92"
"311f","344d"                                           =   "V2Z93"
"433a","433d"                                           =   "V3Z70"
"433b","433c"                                           =   "V3Z71"
"432a","432b","432c","432d"                             =   "V3Z80"
"311d"                                                  =   "V3Z90"
"343a"                                                  =   "V4Z80"
"434a","434d","434e","434f","434g"                      =   "V4Z83"
"434b","434c"                                           =   "V4Z85"
"227a"                                                  =   "V5Z00"
"435a","435b"                                           =   "V5Z81"
"424a"                                                  =   "V5Z82"
"422d","422e"                                           =   "V5Z84"
"421a","421b"                                           =   "W0Z80"
"341a","422a","422b","422c"                             =   "W0Z90"
"227b","341b"                                           =   "W0Z91"
"342a","342b","342c","342d"                             =   "W0Z92"
"423a","423b"                                           =   "W1Z80"
"335a"                                                  =   "X0Z00"
"441a","441b"                                           =   "X0Z01"
 other                                                  =   "ZZZZZ";
run;

Any idea please ?

Thank you in advance,

Fabien

1 Like

Using RStudio's powerful text editors two features

  1. find/replace
  2. use alt to drag the curser down the script so that you can type the same text on every line simultaneously

allow you to type the same condition at the start of every line FAP9PCX %in% c(
close that condition and adopt case_when semantics by globally replacing = with ) ~
use the alt type trick to end each line with a comma.
Finally add start and end code to complete the case when semantics.

result:

FAP9PCX <- "111f"

case_when(
FAP9PCX %in% c("111a","111f","121a","121f","122a","131a","131f"        ) ~    "A0Z00",
FAP9PCX %in% c("111d","111e","121d","121e","131d","131e"               ) ~    "A0Z01",
FAP9PCX %in% c("122b"                                                  ) ~    "A0Z02",
FAP9PCX %in% c("100x","691e"                                           ) ~    "A0Z40",
FAP9PCX %in% c("691b"                                                  ) ~    "A0Z41",
FAP9PCX %in% c("533b","691f"                                           ) ~    "A0Z42",
FAP9PCX %in% c("691a"                                                  ) ~    "A0Z43",
FAP9PCX %in% c("111b","121b","131b"                                    ) ~    "A1Z00",
FAP9PCX %in% c("111c","121c","131c"                                    ) ~    "A1Z01",
FAP9PCX %in% c("691c"                                                  ) ~    "A1Z40",
FAP9PCX %in% c("631a"                                                  ) ~    "A1Z41",
FAP9PCX %in% c("691d"                                                  ) ~    "A1Z42",
FAP9PCX %in% c("471a","471b","480a"                                    ) ~    "A2Z70",
FAP9PCX %in% c("381a","381b","381c"                                    ) ~    "A2Z90",
FAP9PCX %in% c("122c"                                                  ) ~    "A3Z00",
FAP9PCX %in% c("692a"                                                  ) ~    "A3Z40",
FAP9PCX %in% c("656a","656b","656c"                                    ) ~    "A3Z41",
FAP9PCX %in% c("389c","480b"                                           ) ~    "A3Z90",
FAP9PCX %in% c("671a","671b","671c","671d"                             ) ~    "B0Z20",
FAP9PCX %in% c("681a"                                                  ) ~    "B0Z21",
FAP9PCX %in% c("211h","621a","621b","621d","621e","621f","621g"        ) ~    "B1Z40",
FAP9PCX %in% c("211a","632a"                                           ) ~    "B2Z40",
FAP9PCX %in% c("214d","632b"                                           ) ~    "B2Z41",
FAP9PCX %in% c("624d"                                                  ) ~    "B2Z42",
FAP9PCX %in% c("632c"                                                  ) ~    "B2Z43",
FAP9PCX %in% c("211c","632e"                                           ) ~    "B2Z44",
FAP9PCX %in% c("681b"                                                  ) ~    "B3Z20",
FAP9PCX %in% c("211d","632f"                                           ) ~    "B4Z41",
FAP9PCX %in% c("211b","632d","632j"                                    ) ~    "B4Z42",
FAP9PCX %in% c("211e","633a"                                           ) ~    "B4Z43",
FAP9PCX %in% c("211f","632g","632h"                                    ) ~    "B4Z44",
FAP9PCX %in% c("621c","651a"                                           ) ~    "B5Z40",
FAP9PCX %in% c("472b"                                                  ) ~    "B6Z70",
FAP9PCX %in% c("211j","472c","472d"                                    ) ~    "B6Z71",
FAP9PCX %in% c("472a"                                                  ) ~    "B6Z72",
FAP9PCX %in% c("481a","481b"                                           ) ~    "B6Z73",
FAP9PCX %in% c("312f","382b"                                           ) ~    "B7Z90",
FAP9PCX %in% c("382a","382c"                                           ) ~    "B7Z91",
FAP9PCX %in% c("672a"                                                  ) ~    "C0Z20",
FAP9PCX %in% c("622a","622b","622c","622d","622e","622f","622g"        ) ~    "C1Z40",
FAP9PCX %in% c("473b","473c"                                           ) ~    "C2Z70",
FAP9PCX %in% c("473a"                                                  ) ~    "C2Z71",
FAP9PCX %in% c("482a"                                                  ) ~    "C2Z80",
FAP9PCX %in% c("673a","673b"                                           ) ~    "D0Z20",
FAP9PCX %in% c("628c","628d"                                           ) ~    "D1Z40",
FAP9PCX %in% c("623f","623g"                                           ) ~    "D1Z41",
FAP9PCX %in% c("211g","212b","623a","634b"                             ) ~    "D2Z40",
FAP9PCX %in% c("623b"                                                  ) ~    "D2Z41",
FAP9PCX %in% c("623c","623d","623e"                                    ) ~    "D2Z42",
FAP9PCX %in% c("673c","682a"                                           ) ~    "D3Z20",
FAP9PCX %in% c("624a","624b","624c","624e","624g"                      ) ~    "D4Z40",
FAP9PCX %in% c("624f"                                                  ) ~    "D4Z41",
FAP9PCX %in% c("474b","474c"                                           ) ~    "D6Z70",
FAP9PCX %in% c("474a"                                                  ) ~    "D6Z71",
FAP9PCX %in% c("212c","212d","483a"                                    ) ~    "D6Z80",
FAP9PCX %in% c("674a"                                                  ) ~    "E0Z20",
FAP9PCX %in% c("674b","674c"                                           ) ~    "E0Z21",
FAP9PCX %in% c("674d"                                                  ) ~    "E0Z22",
FAP9PCX %in% c("674e"                                                  ) ~    "E0Z23",
FAP9PCX %in% c("676e"                                                  ) ~    "E0Z24",
FAP9PCX %in% c("625a","626a"                                           ) ~    "E1Z40",
FAP9PCX %in% c("625c"                                                  ) ~    "E1Z41",
FAP9PCX %in% c("625e","625f","625g"                                    ) ~    "E1Z42",
FAP9PCX %in% c("625h","626b","637a"                                    ) ~    "E1Z43",
FAP9PCX %in% c("626c"                                                  ) ~    "E1Z44",
FAP9PCX %in% c("479a","625b","628f"                                    ) ~    "E1Z46",
FAP9PCX %in% c("628g"                                                  ) ~    "E1Z47",
FAP9PCX %in% c("475a","475b","485a"                                    ) ~    "E2Z70",
FAP9PCX %in% c("484a","484b"                                           ) ~    "E2Z80",
FAP9PCX %in% c("675a"                                                  ) ~    "F0Z20",
FAP9PCX %in% c("627a","627b","627c"                                    ) ~    "F1Z40",
FAP9PCX %in% c("213a","635a"                                           ) ~    "F1Z41",
FAP9PCX %in% c("675b"                                                  ) ~    "F2Z20",
FAP9PCX %in% c("214a","214b"                                           ) ~    "F3Z40",
FAP9PCX %in% c("627d"                                                  ) ~    "F3Z41",
FAP9PCX %in% c("675c"                                                  ) ~    "F4Z20",
FAP9PCX %in% c("214c","627e","627f"                                    ) ~    "F4Z41",
FAP9PCX %in% c("476a","476b","485b"                                    ) ~    "F5Z70",
FAP9PCX %in% c("628a","634d"                                           ) ~    "G0A40",
FAP9PCX %in% c("628b","633d"                                           ) ~    "G0A41",
FAP9PCX %in% c("216c","633b"                                           ) ~    "G0A42",
FAP9PCX %in% c("632k"                                                  ) ~    "G0A43",
FAP9PCX %in% c("216b","634a"                                           ) ~    "G0B40",
FAP9PCX %in% c("212a","216a","633c","634c"                             ) ~    "G0B41",
FAP9PCX %in% c("477b","477c","477d","486a","486b","486c","486d"        ) ~    "G1Z70",
FAP9PCX %in% c("479b"                                                  ) ~    "G1Z71",
FAP9PCX %in% c("486e"                                                  ) ~    "G1Z80",
FAP9PCX %in% c("380a","383b","384b","385b","386d","386e"               ) ~    "H0Z90",
FAP9PCX %in% c("387e","387f"                                           ) ~    "H0Z91",
FAP9PCX %in% c("387c","387d"                                           ) ~    "H0Z92",
FAP9PCX %in% c("676a","676b","676c","676d"                             ) ~    "J0Z20",
FAP9PCX %in% c("652a","652b","653a"                                    ) ~    "J1Z40",
FAP9PCX %in% c("487a","487b"                                           ) ~    "J1Z80",
FAP9PCX %in% c("217a","526e","642a","642b"                             ) ~    "J3Z40",
FAP9PCX %in% c("641b"                                                  ) ~    "J3Z41",
FAP9PCX %in% c("643a","644a"                                           ) ~    "J3Z42",
FAP9PCX %in% c("217b","218a","641a"                                    ) ~    "J3Z43",
FAP9PCX %in% c("651b","654a","654b","654c"                             ) ~    "J3Z44",
FAP9PCX %in% c("655a"                                                  ) ~    "J4Z40",
FAP9PCX %in% c("546a"                                                  ) ~    "J4Z60",
FAP9PCX %in% c("466c","477a"                                           ) ~    "J4Z80",
FAP9PCX %in% c("546d","546e"                                           ) ~    "J5Z60",
FAP9PCX %in% c("546c"                                                  ) ~    "J5Z61",
FAP9PCX %in% c("546b"                                                  ) ~    "J5Z62",
FAP9PCX %in% c("226b","466a","466b"                                    ) ~    "J5Z80",
FAP9PCX %in% c("389a","451d"                                           ) ~    "J6Z90",
FAP9PCX %in% c("389b"                                                  ) ~    "J6Z91",
FAP9PCX %in% c("387b"                                                  ) ~    "J6Z92",
FAP9PCX %in% c("685a"                                                  ) ~    "K0Z20",
FAP9PCX %in% c("210x","214e","214f","217d","637b","637d"               ) ~    "K0Z40",
FAP9PCX %in% c("542a","542b"                                           ) ~    "L0Z60",
FAP9PCX %in% c("543a","543b","543c"                                    ) ~    "L1Z60",
FAP9PCX %in% c("313a","541a","541b","541c","541d"                      ) ~    "L2Z60",
FAP9PCX %in% c("543d","543e","543f","543g","543h"                      ) ~    "L2Z61",
FAP9PCX %in% c("461a","461b","461c"                                    ) ~    "L3Z80",
FAP9PCX %in% c("461e","461f"                                           ) ~    "L4Z80",
FAP9PCX %in% c("461d"                                                  ) ~    "L4Z81",
FAP9PCX %in% c("312c","312d","372a","372b","373a","373b","373c","373d" ) ~    "L5Z90",
FAP9PCX %in% c("372e"                                                  ) ~    "L5Z91",
FAP9PCX %in% c("372c","372d"                                           ) ~    "L5Z92",
FAP9PCX %in% c("232a","233a","233b","233c","233d"                      ) ~    "L6Z00",
FAP9PCX %in% c("231a","371a"                                           ) ~    "L6Z90",
FAP9PCX %in% c("544a"                                                  ) ~    "M0Z60",
FAP9PCX %in% c("478a"                                                  ) ~    "M1Z80",
FAP9PCX %in% c("478b","478c","478d"                                    ) ~    "M1Z81",
FAP9PCX %in% c("388a","388c"                                           ) ~    "M2Z90",
FAP9PCX %in% c("388b"                                                  ) ~    "M2Z91",
FAP9PCX %in% c("388e"                                                  ) ~    "M2Z92",
FAP9PCX %in% c("312e","383a","384a","385a","386a","386b","386c"        ) ~    "N0Z90",
FAP9PCX %in% c("342e","342f","342g","342h"                             ) ~    "N0Z91",
FAP9PCX %in% c("522a"                                                  ) ~    "P0Z60",
FAP9PCX %in% c("523a","523b","523c","523d","524a","524b","524c","524d" ) ~    "P0Z61",
FAP9PCX %in% c("533c"                                                  ) ~    "P0Z61",
FAP9PCX %in% c("521a","521b"                                           ) ~    "P0Z62",
FAP9PCX %in% c("451c"                                                  ) ~    "P1Z80",
FAP9PCX %in% c("451e","451f","451g","451h"                             ) ~    "P1Z81",
FAP9PCX %in% c("451a","451b"                                           ) ~    "P1Z82",
FAP9PCX %in% c("331a","332a","332b","333b","333e","333f","351a"        ) ~    "P2Z90",
FAP9PCX %in% c("333c","333d"                                           ) ~    "P2Z91",
FAP9PCX %in% c("334a"                                                  ) ~    "P2Z92",
FAP9PCX %in% c("312a","312b","312g"                                    ) ~    "P3Z90",
FAP9PCX %in% c("333a"                                                  ) ~    "P3Z91",
FAP9PCX %in% c("531a","531c","532a","532b","532c","533a"               ) ~    "P4Z60",
FAP9PCX %in% c("531b"                                                  ) ~    "P4Z61",
FAP9PCX %in% c("452a","452b"                                           ) ~    "P4Z80",
FAP9PCX %in% c("545a","545b","545c","545d"                             ) ~    "Q0Z60",
FAP9PCX %in% c("467a","467b"                                           ) ~    "Q1Z80",
FAP9PCX %in% c("467c","467d"                                           ) ~    "Q1Z81",
FAP9PCX %in% c("376a","376b","376c","376d"                             ) ~    "Q2Z90",
FAP9PCX %in% c("226a","376e","376f"                                    ) ~    "Q2Z91",
FAP9PCX %in% c("551a"                                                  ) ~    "R0Z60",
FAP9PCX %in% c("552a","554j"                                           ) ~    "R0Z61",
FAP9PCX %in% c("219a","554a"                                           ) ~    "R1Z60",
FAP9PCX %in% c("554b","554c"                                           ) ~    "R1Z61",
FAP9PCX %in% c("554d","554e","554f","554g"                             ) ~    "R1Z62",
FAP9PCX %in% c("556a"                                                  ) ~    "R1Z63",
FAP9PCX %in% c("553a","553b","553c","554h"                             ) ~    "R1Z66",
FAP9PCX %in% c("555a"                                                  ) ~    "R1Z67",
FAP9PCX %in% c("225a","463a","463b","463c","463d"                      ) ~    "R2Z80",
FAP9PCX %in% c("463e"                                                  ) ~    "R2Z83",
FAP9PCX %in% c("220x","222a","222b","223a","223b","223c","223d","223e" ) ~    "R3Z80",
FAP9PCX %in% c("223f","223g","223h","462a","462b","462d"               ) ~    "R3Z80",
FAP9PCX %in% c("221a","221b"                                           ) ~    "R3Z81",
FAP9PCX %in% c("462c","462e"                                           ) ~    "R3Z82",
FAP9PCX %in% c("374b","374c","374d"                                    ) ~    "R4Z90",
FAP9PCX %in% c("382d","383c","384c","385c","387a","388d"               ) ~    "R4Z91",
FAP9PCX %in% c("374a"                                                  ) ~    "R4Z92",
FAP9PCX %in% c("226c","376g"                                           ) ~    "R4Z93",
FAP9PCX %in% c("215d","683a"                                           ) ~    "S0Z20",
FAP9PCX %in% c("215b","625d","636a"                                    ) ~    "S0Z40",
FAP9PCX %in% c("215c","636b"                                           ) ~    "S0Z41",
FAP9PCX %in% c("215a","636c"                                           ) ~    "S0Z42",
FAP9PCX %in% c("561d"                                                  ) ~    "S1Z20",
FAP9PCX %in% c("636d"                                                  ) ~    "S1Z40",
FAP9PCX %in% c("488a"                                                  ) ~    "S1Z80",
FAP9PCX %in% c("561e","561f"                                           ) ~    "S2Z60",
FAP9PCX %in% c("561a","561b","561c"                                    ) ~    "S2Z61",
FAP9PCX %in% c("468a"                                                  ) ~    "S2Z80",
FAP9PCX %in% c("468b"                                                  ) ~    "S2Z81",
FAP9PCX %in% c("224a","224b","224c","224d"                             ) ~    "S3Z00",
FAP9PCX %in% c("377a","488b"                                           ) ~    "S3Z90",
FAP9PCX %in% c("217c","562a","562b"                                    ) ~    "T0Z60",
FAP9PCX %in% c("563c"                                                  ) ~    "T1Z60",
FAP9PCX %in% c("563b"                                                  ) ~    "T2A60",
FAP9PCX %in% c("563a"                                                  ) ~    "T2B60",
FAP9PCX %in% c("564a"                                                  ) ~    "T3Z60",
FAP9PCX %in% c("534a","534b"                                           ) ~    "T3Z61",
FAP9PCX %in% c("217e","525a","525b","525c","684a"                      ) ~    "T4Z60",
FAP9PCX %in% c("525d"                                                  ) ~    "T4Z61",
FAP9PCX %in% c("628e","684b"                                           ) ~    "T4Z62",
FAP9PCX %in% c("227c","227d","564b"                                    ) ~    "T6Z61",
FAP9PCX %in% c("464a"                                                  ) ~    "U0Z80",
FAP9PCX %in% c("464b"                                                  ) ~    "U0Z81",
FAP9PCX %in% c("375a","375b"                                           ) ~    "U0Z90",
FAP9PCX %in% c("372f","425a"                                           ) ~    "U0Z91",
FAP9PCX %in% c("352a","353a"                                           ) ~    "U0Z92",
FAP9PCX %in% c("353b","353c","465b","637c"                             ) ~    "U1Z80",
FAP9PCX %in% c("465c"                                                  ) ~    "U1Z81",
FAP9PCX %in% c("465a"                                                  ) ~    "U1Z82",
FAP9PCX %in% c("354b","354c","354d","354e","354f","354g"               ) ~    "U1Z91",
FAP9PCX %in% c("352b"                                                  ) ~    "U1Z92",
FAP9PCX %in% c("354a"                                                  ) ~    "U1Z93",
FAP9PCX %in% c("526a","526b","526c","526d"                             ) ~    "V0Z60",
FAP9PCX %in% c("431a","431b","431c","431d","431f","431g"               ) ~    "V1Z80",
FAP9PCX %in% c("431e"                                                  ) ~    "V1Z81",
FAP9PCX %in% c("311a","311b","344a","344b","344c"                      ) ~    "V2Z90",
FAP9PCX %in% c("311c"                                                  ) ~    "V2Z91",
FAP9PCX %in% c("311e"                                                  ) ~    "V2Z92",
FAP9PCX %in% c("311f","344d"                                           ) ~    "V2Z93",
FAP9PCX %in% c("433a","433d"                                           ) ~    "V3Z70",
FAP9PCX %in% c("433b","433c"                                           ) ~    "V3Z71",
FAP9PCX %in% c("432a","432b","432c","432d"                             ) ~    "V3Z80",
FAP9PCX %in% c("311d"                                                  ) ~    "V3Z90",
FAP9PCX %in% c("343a"                                                  ) ~    "V4Z80",
FAP9PCX %in% c("434a","434d","434e","434f","434g"                      ) ~    "V4Z83",
FAP9PCX %in% c("434b","434c"                                           ) ~    "V4Z85",
FAP9PCX %in% c("227a"                                                  ) ~    "V5Z00",
FAP9PCX %in% c("435a","435b"                                           ) ~    "V5Z81",
FAP9PCX %in% c("424a"                                                  ) ~    "V5Z82",
FAP9PCX %in% c("422d","422e"                                           ) ~    "V5Z84",
FAP9PCX %in% c("421a","421b"                                           ) ~    "W0Z80",
FAP9PCX %in% c("341a","422a","422b","422c"                             ) ~    "W0Z90",
FAP9PCX %in% c("227b","341b"                                           ) ~    "W0Z91",
FAP9PCX %in% c("342a","342b","342c","342d"                             ) ~    "W0Z92",
FAP9PCX %in% c("423a","423b"                                           ) ~    "W1Z80",
FAP9PCX %in% c("335a"                                                  ) ~    "X0Z00",
FAP9PCX %in% c("441a","441b"                                           ) ~    "X0Z01",
TRUE                                                   ~    "ZZZZZ")
2 Likes

Terrific !

Many thanks !

Have a nice day.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.