SAS Notes

Compiled by : Wilson Suraweera @ CGHR
Contents
Random Numbers in SAS
Data Sub-setting
Selection  of  two Random Samples
Missing values replacement with Means of the respective Variables
Logistic Regression with SAS
SAS made easy using Proc SQL
SAS PROC SQL procedure to access external ODBC data sources
SAS String Data Handling
External Resources
Macro Seminar - UCLA
Logistic regression
          Some Interesting SAS SQL Examples
SAS Dinosaur - Old and New way of SAS progrming
Paul Dicman's Web Page for SAS- This little old discusses SAS 8, but useful
Global Statements Dictionary - Alphabatical listing and Description of SAS Key words

 

         

  1. SAS Strings

    1. Concatenation functions

    /*****************************************************************************/
    /* Title: Concatenation functions in SAS 9.0                                                                                               */
    /*                                                                                                                                                              */
    /* Goal : Illustrate the new CAT functions.                                                                                                  */
    /*                                                                                                                                                               */
    /* Note :  CAT  - concatenates character strings without removing leading or    trailing blanks                       */
    /*         CATS - concatenates character strings and removes leading  and trailing blanks                               */
    /*         CATT - concatenates character strings and removes trailing blanks                                                  */
    /*         CATX - concatenates character strings, removes leading and  trailing blanks, and inserts separators  */
    /*                                                                           */
    /*****************************************************************************/

    data test;
      input (x1-x4) ($);
      x5=' 5';
      length new1 $40 new2-new4 $10 ;
      new1=cat(of x1-x5);
      new2=cats(of x1-x5);
      new3=catt(x1,x2,x3,x4,x5);
      new4=catx(',', of x1-x5);
      keep new:;
    datalines;
    1 2 3 4
    5 6 . 8
    ;

    proc print;
    run;

    /* RESULTS */

    Obs                   new1                   new2      new3       new4

     1     1       2       3       4        5    12345    1234 5    1,2,3,4,5
     2     5       6               8        5    5685     568 5     5,6,8,5
     

     

     

Learn More  : ftp://ftp.sas.com/techsup/download/sample/datastep/concat_function.html

Back to Top