BookmarkSubscribeRSS Feed
ehuck22
Calcite | Level 5

I am trying to do summary statistics on excel spreadsheet I have written the code and tried to save it to a library.

PROC IMPORT DATAFILE="/folders/myfolders/MIS445/MIS445_FRED-real_GDP.xlsx"
		    OUT=WORK.FRED
		    DBMS=XLSX
		    REPLACE;
RUN;

/** Print the results. **/


LIBNAME MIS445 "/folders/myfolders/MIS445;
data work.FRED;
	SET MIS445.FRED;

RUN;

I then go to the Task and Utilities section and click on the summary statistics. The Summary window tells me that I need to pick a data set from "MyLibraries" but my data set is not in there. 

 

Second, I keep getting an error saying that there are no columns. Please help.

4 REPLIES 4
ballardw
Super User

@ehuck22 wrote:

I am trying to do summary statistics on excel spreadsheet I have written the code and tried to save it to a library.

PROC IMPORT DATAFILE="/folders/myfolders/MIS445/MIS445_FRED-real_GDP.xlsx"
		    OUT=WORK.FRED
		    DBMS=XLSX
		    REPLACE;
RUN;

/** Print the results. **/


LIBNAME MIS445 "/folders/myfolders/MIS445;
data work.FRED; <= The data set name here is the OUTPUT set, likely you meant the MIS445.Fred.
	SET MIS445.FRED; <= the data set here is the INPUT, likely the one created by Proc Import above

RUN;

I then go to the Task and Utilities section and click on the summary statistics. The Summary window tells me that I need to pick a data set from "MyLibraries" but my data set is not in there. 

 

Second, I keep getting an error saying that there are no columns. Please help.


However depending on what actually happened you may have destroyed your work.fred and need to reimport it.

ehuck22
Calcite | Level 5

I reimported the data and am now trying to get summary statistics. I get this error message

/*
 *
 * Code cannot be generated because the following 
 * roles are not set: 
 *
 *  Analysis variables: (minimum: 1)
 *
 *
 */ How do I add a variable
ghosh
Barite | Level 11
LIBNAME MIS445 "/folders/myfolders/MIS445;

PROC IMPORT DATAFILE="/folders/myfolders/MIS445/MIS445_FRED-real_GDP.xlsx"
		    OUT= MIS445.FRED;
		    DBMS=XLSX
		    REPLACE;
RUN;


Just import the excel file right into a permanent dataset in the stored in the location pointed to by MIS445 and then start your summary statistics 

ChrisNZ
Tourmaline | Level 20

Your code makes no sense:

1. You create table WORK.FRED twice, so the first version (created from the excel data) is overwritten

2. I see no analysis performed in that code.  How do you summarise?

 

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!

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
  • 4 replies
  • 766 views
  • 0 likes
  • 4 in conversation