06-29-2017 07:23 AM
I have data in excel file in Base64 format. Typical row is:
I am trying to read this in SAS. Accused_Name is in Base64x format. If I decode it using generic websites on Google it returns "दीप चंद" which is Hindi text. I want the final result in English which should be "Deep Chand". How can I achieve this ? I am using below line of code to deocde base64 but it doesn't give even दीप चंद.
%let name ='4KSm4KWA4KSqIOCkmuCkguCkpg==';
%let name_decode = (%sysfunc(inputc(%scan(&name,1,':')===,$base64x12.)));
06-29-2017 10:09 AM - edited 06-29-2017 10:10 AM
I would use something like that. Basically, you need to know the length of Base64 encoded string. So in your case, you can use $base64x28., instead of $base64x32767. 32767 is the max length of string when using Base64.
%let name ='4KSm4KWA4KSqIOCkmuCkguCkpg=='; %let name_decode = (%trim(%sysfunc(inputc(%scan(&name,1,':')===,$base64x32767.)))); %put &=name_decode;
06-30-2017 02:37 AM
Hi @alexal - The output given by base64decode.org is दीप चंद . But if I execute the code in SAS, it doesn't give this result. I am assuming that is because दीप चंद is in Devnagri (Hindi) script. How can I force my SAS to decode the output in Devnagri script ? Would NLS help ? Finally, I need English output. So, first I need to Decode Base64 to Devnagri and then back to English.