I have data in excel file in Base64 format. Typical row is:
REF_NO | ACC_REF_NO | FIN_YEAR | ACCUSED_NAME |
303 | 325 | 20162017 | 4KSm4KWA4KSqIOCkmuCkguCkpg== |
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.)));
%put &=name_decode;
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;
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.
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.