BookmarkSubscribeRSS Feed
bhr-q
Pyrite | Level 9

Hello all,

I ran the following code to import an Excel sheet, but PROC CONTENTS only displays two variables, even though the sheet contains 12 variables. Could you please help me to fix that?

all is fine; there is no error, and I can see all the data with the proc print; the issue is only proc contents that show two variables.

PROC IMPORT 
    DATAFILE="\\FS12000\USR-SPC\by\Desktop\Bita\Scoresheet.xlsx"
    OUT=work.AI_Derm
    DBMS=xlsx
    replace;
    SHEET="AI";
	getnames=yes;
RUN;
proc contents data=AI_Derm;
run;

 

Thanks

 

 

3 REPLIES 3
Tom
Super User Tom
Super User

What did the log say for each of your two steps?  Did you get any errors or warnings or unexpected notes?

 

Why did you create a dataset named work.AI_Derm and then run PROC CONTENTS on AI_Derm? Normally those mean the same dataset, but they could mean two different datasets if you have USER library assigned.

 

Are you sure you are looking at the same XLSX file as SAS is reading from?

bhr-q
Pyrite | Level 9

I am sorry, that is weird; now it works; sorry again, I was in a rush.

Thanks a lot for your answer,

mkeintz
PROC Star

@bhr-q wrote:

I am sorry, that is weird; now it works; sorry again, I was in a rush.

Thanks a lot for your answer,


That's ok.  But mark your comment as the "solution", so that folks looking for unsolved topics don't needlessly review this one.

--------------------------
The hash OUTPUT method will overwrite a SAS data set, but not append. That can be costly. Consider voting for Add a HASH object method which would append a hash object to an existing SAS data set

Would enabling PROC SORT to simultaneously output multiple datasets be useful? Then vote for
Allow PROC SORT to output multiple datasets

--------------------------

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 242 views
  • 1 like
  • 3 in conversation