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 2024

Innovate_SAS_Blue.png

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. 

Register now!

From SAS Users blog
Want more? Visit our blog for more articles like these.
5 Steps to Your First Analytics Project Using SAS

For SAS newbies, this video is a great way to get started. James Harroun walks through the process using SAS Studio for SAS OnDemand for Academics, but the same steps apply to any analytics project.

Find more tutorials on the SAS Users YouTube channel.

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