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.png

📢

ANNOUNCEMENT

The early bird rate has been extended! Register by March 18 for just $695 - $100 off the standard rate.

 

Check out the agenda and get ready for a jam-packed event featuring workshops, super demos, breakout sessions, roundtables, inspiring keynotes and incredible networking events. 

 

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
  • 269 views
  • 0 likes
  • 2 in conversation