Hello Everyone,
I have to import Excel expenditure form. The first 11 row is non-standard with all company information and I dont need it. So I should start from row 12.
And the last few rows contain requirement which I dont need them either.
I attached sample file here.
My approach to it is to import from row 12, and then delete any row after the Total number.
I use the following code but can get the import done.
Can anyone help, please?
Thank you so much,
HC
data TimeHour ;
infile "C:\Users\Original Files\test.xlsx"
firstobs=12
dlm=',' dsd truncover ;
input Date date9. Start :$100 End :$100 Hotel :$100 GroundTransit :$100 Airfare CarRental Meals
Phone Miles MileageReimbursment Misc :$100 Description :$100 CompanyPaid col1 Total
;run;
You can't use a data step to read an XLSX file.
If you convert it to CSV or text you can process it as desired.
Or you can try the RANGE specification in PROC IMPORT. I'd probably specify the RANGE - you only need to know the start cell - and then post process the data to remove the last lines. If you know the full range that's easier.
You can't use a data step to read an XLSX file.
If you convert it to CSV or text you can process it as desired.
Or you can try the RANGE specification in PROC IMPORT. I'd probably specify the RANGE - you only need to know the start cell - and then post process the data to remove the last lines. If you know the full range that's easier.
So I save the file as CSV.
But when I run the code, still data not imported properly.
Sorry, I fix it.
Thank you.
HC
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.