Help using Base SAS procedures

SAS Concatenate no nulls

Regular Contributor
Regular Contributor
Posts: 238

SAS Concatenate no nulls

I want to concatenate 30 columns and there are 57k rows. I can concatenate but it also includes the rows with null values and I do not want them because then my next series of code does not work right because of the null values in the concatenation. The code I have is this:

data claims13; set claims14;




The compress does not work to get rid of the null values. All 30 columns vary on which one have nulls and which ones do not. Here is an example of that: (again I have 57krows)

memberid      readm1      readm2       readm3         readm4      readm5        readm6       readm7       readm8        all the way to readm30

1111               1                                                     1                                   1               1

2222                                 1                  1                                  1                                                    1                         1

3333                1                1                 1

4444                                                                       1                                 1                                    1                         1

If I use the above code it does concatenate everything but it will do it like this

memberid      readm

1111             1..1.11..

2222             .11.1..11

3333             111.....

4444             ..1.1.11

I do not think those are really periods but null values and I just want them all gone so that I only have the following

memberid        readm

1111                 1111

2222                 11111

3333                 111

4444                 1111

Trusted Advisor
Posts: 1,300

SAS Concatenate no nulls

data bar;

array readm[30];

do memberid=1 to 57000;

  do i=1 to dim(readm);





drop i;


options missing=' ';

data foo;

length readm $30;

set bar;

readm=cats(of readm1-readm30);


Regular Contributor
Regular Contributor
Posts: 238

SAS Concatenate no nulls

Almost works but it changes my memberid to 1, 2, 3 and so on and does not keep the actual memberid. I need the memberID to remain intact because that is my primary key and has to go back to other code I run later. This code is to concatenate the memberid's readm columns. Once that is done I take the original memberID along with this concatenate and have to do a code that goes back to my severity tables. This output isSmiley Sadthe memberids in here are made up due to HIPAA. The memberid is actual our members social securiy number)

unique memberid              readm                severitycode               severitylevel

1111                                11                         1                             minor

2222                               1                           2                              moderate

3333                               11111                    3                              major

4444                                111                      4                              excessive

Regular Contributor
Regular Contributor
Posts: 238

SAS Concatenate no nulls

Actually this worked to get rid of nulls and concatenate my columns

data readm.claims13; set readm.claims12;




Ask a Question
Discussion stats
  • 3 replies
  • 2 in conversation