06-21-2016 10:54 PM
I have an excel sheet which has more than one entry for some variables for a given obervation.It looks something like this:
There are no delimiters either. When I read it from sas it also looks exactly like the table above.
But I want sas to read it like the table given below ( where the multiple entries are separated in to rows):
I'm new to programming so any help would be much appreciated! Thanks!
06-22-2016 12:50 AM
SAS can't read it by default. You can parse it out however, look at the SCAN function.
Do all your data have 3 values or do they vary?
This is pretty much your question. You'll need to do have two functions in the loop though, 1 for the name and 1 for the value.
data Loans (keep= AccountNo Loan); infile datalines truncover; Input @1 AccountNo 3. @17 LoanList $250.; if length(LoanList) gt 240 then put 'WARNING: You might need to extend Loans'; label AccountNo = 'Account Number' Loan = 'Loans'; do loanNo = 1 to countw(LoanList, ','); Loan = scan(LoanList, loanNo, ','); output; end; datalines; 123 abc, def, ghi 456 jkl, mnopqr, stuv 789 w, xyz ; proc print data=Loans label noobs; run;