Posts Tagged ‘ Tip ’

Interview SAS Programmer

May 11, 2012
By

Interviewing and Accessing SAS Programmers
Read more »

Tags:
Posted in SAS | Comments Off

How to preserve leading zeros when export to csv file

April 1, 2011
By

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...
Read more »

Tags: ,
Posted in SAS | Comments Off

Create transport file and Read in transport file

February 9, 2011
By

*** 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...
Read more »

Tags:
Posted in SAS | Comments Off

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

January 14, 2011
By

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=...
Read more »

Tags: ,
Posted in SAS | Comments Off

LAG function

January 4, 2011
By

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;      do over one;            temp = lag(one);            if...
Read more »

Tags: ,
Posted in SAS | Comments Off

Label variable with special character

November 23, 2010
By

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;       col age new;       define new / format=$30. ;/* for the RTF */  &n...
Read more »

Tags: , ,
Posted in SAS | Comments Off

Generate random numbers

November 15, 2010
By

options pageno=1 nodate ls=80 ps=64;data u1(keep=x);      seed = 104;      do i = 1 to 5;            call ranuni(seed, x);            output;      end;     ...
Read more »

Tags: , ,
Posted in SAS | Comments Off

Handling leading, trailing blanks in macro variable

June 16, 2010
By

If a macro variable contains leading or trailing blanks, they can be easily removed without the use of %LEFT or %TRIM. Simply:%let macvar = &macvar;
Read more »

Tags: ,
Posted in SAS | Comments Off

Welcome!

SAS-X.com offers news and tutorials about the various SAS® software packages, contributed by bloggers. You are welcome to subscribe to e-mail updates, or add your SAS-blog to the site.

SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other countries. ® indicates USA registration.