if I have an excel file looks like this.
I use proc import detafile=.......... out=projoct_data;
and have a table like this:
How could I fix it?
Moreover, I want to row 2 in excel to become the name of data in the sas table, not F6,7,8,9...
Show the actual CODE you used to read the excel file.
Do you actually have an XLSX file? Or did you accidentally let Excel open a CSV file?
If you have an XLSX file then use the RANGE statement to tell it start in cell A2 instead of A1.
Here is example:
%let fname = %sysfunc(pathname(work))/class.xlsx; proc export data=sashelp.class file="&fname" dbms=xlsx replace; run; proc import file="&fname" dbms=xlsx out=test1 replace; run; proc import file="&fname" dbms=xlsx out=test2 replace; range='$A2:'; getnames=NO; run; proc compare data=test1 compare=test2; var name sex age height weight; with a b c d e; run;
If you have a CSV file then skip the PROC IMPORT and write your own data step to read it. Use the FIRSTOBS=3 option on the INFILE statement to skip both header lines.
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.
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.