BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
BLT2023
Calcite | Level 5

For a school project, one of the things I am being graded on is the correct number of observations appearing when I run proc contents for my code. Some of it works, and some of it doesn't. Here is an example of code that doesn't show the observations: 

Spoiler
LIBNAME Check XLSX "&CourseRoot/CDPHE Study/Data/1_Source/Employment.xlsx";
LIBNAME Check CLEAR;

LIBNAME CoImpt XLSX "&CourseRoot/CDPHE Study/Data/1_Source/Employment.xlsx";
PROC PRINT
		DATA = CoImpt.Employment;
		LABEL;
		
	PROC CONTENTS DATA=CoImpt.Employment;
	RUN;

How do I get the observation count to appear in results when proc contents are run? I know it is not a SAS dataset, but I'm not familiar with the code to get observation counts from other datasets to read in (I cannot change the data for the purposes of the assignment). Thank you for any assistance.

1 ACCEPTED SOLUTION

Accepted Solutions
PaigeMiller
Diamond | Level 26
/* Create SAS data set */
data want;
    set CoImpt.Employment;
run;


/* Run PROC CONTENTS on SAS data set */
proc contents data=want;
run;
--
Paige Miller

View solution in original post

3 REPLIES 3
PaigeMiller
Diamond | Level 26

CoImpt.Employment is not a SAS data set, it is an Excel file.

 

PROC CONTENTS will show the number of observations if it is a SAS data set.

--
Paige Miller
BLT2023
Calcite | Level 5

So is the solution to this to save the .xlsx file as a SAS dataset within SAS and ask in the code for SAS to read in the data from the new .sas data set? If so, how do I write code for this?

PaigeMiller
Diamond | Level 26
/* Create SAS data set */
data want;
    set CoImpt.Employment;
run;


/* Run PROC CONTENTS on SAS data set */
proc contents data=want;
run;
--
Paige Miller

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 3 replies
  • 741 views
  • 0 likes
  • 2 in conversation