Tag: Tip

Send Emails from SAS

For Video Click Here

For Article Click Here and Here


Change SAS email options and use SMTP email.  Refer to:
    Usage Note 19767: Using the SAS® System to send SMTP e-mail
For troubleshooting refer to:
    Usage Note 18363: Troubleshooting guidelines for successfully sending an SMTP e-mail from SAS® software

 

How to preserve leading zeros when export to csv file

data one;input id $;/* create formatting to preserve leading zeros in excel */cid&nbsp =&nbsp ‘&nbsp=&nbsp”&nbsp’&nbsp ||&nbsp id&nbsp ||&nbsp ‘&nbsp”&nbsp’;cards;00123123980123400034;run;data one (drop=id);&nbsp &nbsp &nbsp set one;run;ods listing clo…

Create transport file and Read in transport file

*** Create transport file;libname source “/home/kwxxx/requests/xxxdata”;libname tran xport “/home/kwxx/requests/xxxdata/transport/xxxdata.xpt”;proc copy in=source out=tran memtype=data;run;*** Read in transport file;libname library ‘c:\kwxxx’;libna…

Use BYTE function to create special ASCII character, e.g. plus/minus sign

data _null_;&nbsp &nbsp &nbsp do i=0 to 255;&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp x=byte(i);&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp put i= x=;&nbsp &nbsp &nbsp end;&nbsp &nbsp &nbsp y=rank(‘a’);&nbsp &nbsp &nbsp put y=;run;BYTE function results:i=65 — 90 x=…

LAG function

LAG Function (SAS 9.2 Doc)*** Use a third variable to assign the value from the previous record;array one a b c d;array two e f g h;&nbsp &nbsp &nbsp do over one;&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp temp = lag(one);&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp if…

Label variable with special character

Create delta in the report and label:ods escapechar=’^’;ods rtf file=’temp.rtf’; *** Can be HTML or PDF too;proc report data=sashelp.class nowd ps=40; &nbsp &nbsp &nbsp col age new; &nbsp &nbsp &nbsp define new / format=$30. ;/* for the RTF */&nbsp &n…