BookmarkSubscribeRSS Feed
nickb
Calcite | Level 5

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          
                                                           
************************************************************************************************************************************
                                       

2 REPLIES 2
ballardw
Super User

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;

Tom
Super User Tom
Super User

You might try informat like BZ

sas-innovate-2024.png

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.

 

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
  • 2 replies
  • 784 views
  • 0 likes
  • 3 in conversation