DATA Step, Macro, Functions and more

For those interested in crypto - ₿ Bitcoin SAS Format – $bitcoin.

Reply
New Contributor
Posts: 3

For those interested in crypto - ₿ Bitcoin SAS Format – $bitcoin.

Application of bitcoin format for SAS users. This post also applies to other cryptocurrencies such as Ether and altcoins and integrating them into the SAS platform. Check it out! 

 

https://www.rawsas.com/2018/03/bitcoin-sas-format/

PROC Star
Posts: 2,235

Re: For those interested in crypto - ₿ Bitcoin SAS Format – $bitcoin.

[ Edited ]
Posted in reply to Skorobogatiji

The syntax to use Unicode characters varies wildly, depending on where in SAS one uses them. 

 

SAS/GRAPH titles require a different syntax than SAS/GRAPH legends, which is again different from what ODS Graphs understands, which is also different from what ODS reports need.

 

Here is a summary of my findings. I am just displaying an exponent here, like this:

 

GraphCapturegrp.PNG

 

HTMLCapturehtml.PNG

 

PDFCapturepdf.PNG

 

RTFCapturertf.PNG

 

 

ODS Graphs seem to behave differently than when I last tested these syntaxes. Oh well...

 

 

title;
 
%***************** SAS/GRAPH **********;
%let a=%sysfunc(unicodec(TRT A 5x10, utf16b),$hex40.)00b92070;
%let b=%sysfunc(unicodec(TRT B 1x10, utf16b),$hex40.)00b900b9;
%put &=a ;%put &=b;
legend value=(font="arial unicode ms/unicode" "&a"x "&b"x) ;
axis   value=(font="arial unicode ms/unicode" "&a"x "&b"x 
              font="arial" /* for GIF for next values on axis*/);
        
goptions ypixels=200 xpixels=320 dev=gif;
title1 h=1 font="arial unicode ms" "TRT A 5x10^{super 10}" ;* no /unicode;
title2 h=1 font="arial unicode ms" "TRT B 1x10^{super 11}" ;* for title!;
proc gplot data=SASHELP.CLASS;
  plot WEIGHT*AGE=SEX/legend=legend1 haxis=axis1;
  note c=black f='arial unicode ms/unicode' m=(20,50)pct h=3 "&a"x;
  note c=black f='arial unicode ms/unicode' m=(20,40)pct h=3 "&b"x;
  run;
quit; 
 
goptions dev=actximg;
title;
proc gplot data=SASHELP.CLASS;
  plot WEIGHT*AGE=SEX/legend=legend1 haxis=axis1;
  run;
quit; 
 
 
%***************** ODS GRAPH **********;
proc format ;
  value $sup_sg
    'F'="TRT A 5x10(*ESC*){unicode '00b9'x}(*ESC*){unicode '2070'x}"
    'M'="TRT B 1x10(*ESC*){unicode '00b9'x}(*ESC*){unicode '00b9'x}" ;
ods graphics on / width=620px height=400px;
proc sgpanel data=SASHELP.CLASS;
  format SEX $sup_sg.;
  panelby SEX / novarname headerattrs=GraphUnicodeText;
  scatter x=WEIGHT y=HEIGHT;
run;
 
 
%***************** ODS REPORT **********;
ods escapechar='^' noproctitle;
proc format ;
  value $sup_ods 'F'="TRT A 5x10^{super 10}"
                 'M'="TRT B 1x10^{super 11}" ;
proc freq data=SASHELP.CLASS;
  format SEX $sup_ods.;
  table SEX;
run;       
 
 
data TEST;
  X="TRT A 5x10^{super 10}";
run;
 
title "TRT A 5x10^{super 12}";
 
ods rtf file="%sysfunc(pathname(WORK))\test.rtf" ;
ods pdf file="%sysfunc(pathname(WORK))\test.pdf" ;
ods html file="%sysfunc(pathname(WORK))\test.html" ;
ods excel file="%sysfunc(pathname(WORK))\test.xls" ;
proc print data=TEST noobs;
run;
ods _all_ close;

 

 

Ask a Question
Discussion stats
  • 1 reply
  • 153 views
  • 4 likes
  • 2 in conversation