I am working on reading in a file that has money values in the columns and if they are missing, they need to be $0. I know the position of where the values are but don't know how to handle the missing values. When I copied a snippet of the file the values got shifted but the file is column aligned.
XMITTAL TUITION ACCOUNT BOOK DISBURSEMENT BOOK CHGS TO
NAME SSN TERM DATE & FEES REFUND CHGS TOTAL CARD
========================== =========== ===== =========== ============ =========== =========== ============= ============
Aeva, Gua Z 12/WI 01/18/12 723.20 936.67 190.13 1850.00 50.00
12/SP 04/10/12 703.20 1053.98 92.82 1850.00 60.00
************************************************************************************************************************************
goofy 11/FA 09/16/11 433.60 491.40 925.00
12/WI 01/18/12 295.00 168.00 463.00
************************************************************************************************************************************
daffy 11/SU 07/16/11 602.20 575.38 210.42 1388.00 100.00
11/FA 09/16/11 654.40 270.30 925.30 1850.00 100.00
12/WI 01/18/12 822.40 627.73 399.87 1850.00 100.00
12/SP 04/03/12 462.00 462.00
************************************************************************************************************************************
There are many possible approaches. One is to create a custom INVALUE format for those variables that will assign 0 to the blank or missing or how ever it appears in your data.
Another would be to use an array in a data step. If you are reading the data using input in a data step then add code similar to this:
Array vals list your variable names here;
do i = 1 to dim vals;
if vals=. then vals=0;
end;
drop i;
You might try informat like BZ
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.