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
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;
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
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;
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.