BookmarkSubscribeRSS Feed
tmm
Fluorite | Level 6 tmm
Fluorite | Level 6

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;

readm=cat(readm1-readm30);

readm=compress(readm);

run;

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

3 REPLIES 3
FriedEgg
SAS Employee

data bar;

array readm[30];

do memberid=1 to 57000;

  do i=1 to dim(readm);

   readm=ifn(rand('table',.75,.25)=1,1,.);

  end;

  output;

end;

drop i;

run;

options missing=' ';

data foo;

length readm $30;

set bar;

readm=cats(of readm1-readm30);

run;

tmm
Fluorite | Level 6 tmm
Fluorite | Level 6

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 is:(the 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

tmm
Fluorite | Level 6 tmm
Fluorite | Level 6

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

data readm.claims13; set readm.claims12;

readm=cats(readm1-readm30);

readm=compress(readm);

run;

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 1246 views
  • 0 likes
  • 2 in conversation