BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
vicdicenzo
Obsidian | Level 7

I am trying to run some simple descriptive stats.  My data set only has 11 variables.  Some of those variables are string.  I am using the 'proc import' function to read the excel file.  However, when I run the code, I get the following error messages for the three string variables and I am not sure why.  

 

ERROR: Variable Lake in list does not match type prescribed for this list.
ERROR: Variable Species in list does not match type prescribed for this list.
ERROR: Variable Cat in list does not match type prescribed for this list.

 

Any help would be appreciated. Thanks.

1 ACCEPTED SOLUTION

Accepted Solutions
PaigeMiller
Diamond | Level 26
96         PROC MEANS NOPRINT; BY LAKE YEAR SPECIES CAT; VAR CLASS; Run;
 
 ERROR: Neither the PRINT option nor a valid output statement has been given.
 NOTE: The SAS System stopped processing this step because of errors.
 NOTE: PROCEDURE MEANS used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 97         OUTPUT OUT=NEW N=N;
 98         

PROC MEANS has ended at the point in your code where the error appears (in red), and it does not have all the necessary components. What caused the PROC to come to an end? Can you figure it out?

--
Paige Miller

View solution in original post

15 REPLIES 15
Kurt_Bremser
Super User

Please post the whole log of your code.

Many statistic procedures can only work with numeric variables, so that is most probably the reason.

Either change to a different method for descriptive analysis, or make sure that numeric values are imported as such. Proc import might misunderstand the data.

Tom
Super User Tom
Super User

You need to show the code you ran that generated the error.

It sounds like you think the variables are character variables, but the Excel file you imported from had them defined as numbers.  Or is it the other way around?

Do you have control over the creation of the Excel file?

 

 

Patrick
Opal | Level 21

The error message indicates that the procedure you're using requires these variable to be of type numeric. 

May be post some representative sample data (as a data step creating such data) and especially the actual code you're using or at least the code bit which throws the error.

PaigeMiller
Diamond | Level 26

Please show us the entire SAS log, not just the error messages. Please click on the {i} icon and paste the text into the window that appears; do not paste the log directly into the reply without first clicking on the {i} icon.

--
Paige Miller
vicdicenzo
Obsidian | Level 7
OPTIONS LS=100 PS=100 NOCENTER NODATE NONUMBER;

/** Import an XLSX file.  **/

PROC IMPORT DATAFILE="/folders/myfolders/2019/All fish data 1.XLSX"
		    OUT=WORK.FP
		    DBMS=XLSX
		    REPLACE;
RUN;

*ods rtf file = "/folders/myfolders/2019/KERR 2017 creel result.rtf" BODYTITLE;

run;


*********** BRING IN DAILY COUNT DATA ***************;

DATA DAILY; SET FP; 

PROC SORT; BY LAKE YEAR SPECIES CAT; RUN;
PROC MEANS NOPRINT; VAR LAKE YEAR SPECIES CAT; Run;
OUTPUT OUT=NEW N=N;

DATA B; SET NEW;
PROC PRINT; VAR LAKE YEAR SPECIES CAT N; 
TITLE 'NUMBER OF FISH COLLECTED FROM PICKETT BY LAKE AND SPECIES'; RUN;


*ods rtf close;
run;
PaigeMiller
Diamond | Level 26

This is not the log, this is your code. We need to see the log.

--
Paige Miller
vicdicenzo
Obsidian | Level 7
OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
 NOTE: ODS statements in the SAS Studio environment may disable some output features.
 73         
 74         *************** THIS PROGRAM ANALYZES FORT PICKETT DATA ***********;
 75         
 76         OPTIONS LS=100 PS=100 NOCENTER NODATE NONUMBER;
 77         
 78         /** Import an XLSX file.  **/
 79         
 80         PROC IMPORT DATAFILE="/folders/myfolders/2019/All fish data 1.XLSX"
 81             OUT=WORK.FP
 82             DBMS=XLSX
 83             REPLACE;
 84         RUN;
 
 NOTE: One or more variables were converted because the data type is not supported by the V9 engine. 
       For more details, run with options MSGLEVEL=I.
 NOTE: The import data set has 2826 observations and 11 variables.
 NOTE: WORK.FP data set was successfully created.
 NOTE: PROCEDURE IMPORT used (Total process time):
       real time           0.39 seconds
       cpu time            0.36 seconds
       
 
 85         
 86         *ods rtf file = "/folders/myfolders/2019/KERR 2017 creel result.rtf" BODYTITLE;
 87         
 88         run;
 89         
 90         
 91         *********** BRING IN DAILY COUNT DATA ***************;
 92         
 93         DATA DAILY; SET FP;
 94         
 
 NOTE: There were 2826 observations read from the data set WORK.FP.
 NOTE: The data set WORK.DAILY has 2826 observations and 11 variables.
 NOTE: DATA statement used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 
 95         PROC SORT; BY LAKE YEAR SPECIES CAT; RUN;
 
 NOTE: There were 2826 observations read from the data set WORK.DAILY.
 NOTE: The data set WORK.DAILY has 2826 observations and 11 variables.
 NOTE: PROCEDURE SORT used (Total process time):
       real time           0.00 seconds
       cpu time            0.01 seconds
       
 
 96         PROC MEANS NOPRINT; VAR LAKE YEAR SPECIES CAT; Run;
 ERROR: Variable Lake in list does not match type prescribed for this list.
 ERROR: Variable Species in list does not match type prescribed for this list.
 ERROR: Variable Cat in list does not match type prescribed for this list.
 
 NOTE: The SAS System stopped processing this step because of errors.
 NOTE: PROCEDURE MEANS used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 97         OUTPUT OUT=NEW N=N;
 98         
 
 
 99         DATA B; SET NEW;
 ERROR: File WORK.NEW.DATA does not exist.
 
 NOTE: The SAS System stopped processing this step because of errors.
 WARNING: The data set WORK.B may be incomplete.  When this step was stopped there were 0 
          observations and 0 variables.
 WARNING: Data set WORK.B was not replaced because this step was stopped.
 NOTE: DATA statement used (Total process time):
       real time           0.01 seconds
       cpu time            0.01 seconds
       
 
 
 100        PROC PRINT; VAR LAKE YEAR SPECIES CAT N;
 ERROR: Variable N not found.
 101        TITLE 'NUMBER OF FISH COLLECTED FROM PICKETT BY LAKE AND SPECIES'; RUN;
 NOTE: The SAS System stopped processing this step because of errors.
 NOTE: PROCEDURE PRINT used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 102        
 103        
 104        *ods rtf close;
 105        run;
 106        
 107        
 108        
 109        OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
 121        
Kurt_Bremser
Super User

Take a look at the columns named 

LAKE YEAR SPECIES CAT

in your Excel spreadsheet.

Variables in the VAR statement in proc summary have to be numeric. If those columns are not numeric, choose another method of describing them (eg frequencies).

If the columns are numeric, but proc import has a problem:

Either run an intermediate data step that converts the columns.

Or save the data to a csv file from Excel and import it with a user-written data step that sets correct data types.

Tom
Super User Tom
Super User

How is LAKE coded?  What would the mean of LAKE look like?

You probably want to take the mean of some other variable.  Perhaps you meant to use LAKE in a BY or CLASS statement in PROC MEANS instead of as one of the variables to analyzed?

vicdicenzo
Obsidian | Level 7

LAKE is a 2-digit character variable.  Such as LW, TL, PF, etc.

vicdicenzo
Obsidian | Level 7

I am sorry, I have corrected the VAR code. But still having an issue with proc means noprint

 

NOTE: ODS statements in the SAS Studio environment may disable some output features.
 73         
 74         *************** THIS PROGRAM ANALYZES FORT PICKETT DATA ***********;
 75         
 76         OPTIONS LS=100 PS=100 NOCENTER NODATE NONUMBER;
 77         
 78         /** Import an XLSX file.  **/
 79         
 80         PROC IMPORT DATAFILE="/folders/myfolders/2019/All fish data 1.XLSX"
 81             OUT=WORK.FP
 82             DBMS=XLSX
 83             REPLACE;
 84         RUN;
 
 NOTE: One or more variables were converted because the data type is not supported by the V9 engine. 
       For more details, run with options MSGLEVEL=I.
 NOTE: The import data set has 2826 observations and 11 variables.
 NOTE: WORK.FP data set was successfully created.
 NOTE: PROCEDURE IMPORT used (Total process time):
       real time           0.36 seconds
       cpu time            0.34 seconds
       
 
 85         
 86         *ods rtf file = "/folders/myfolders/2019/KERR 2017 creel result.rtf" BODYTITLE;
 87         
 88         run;
 89         
 90         
 91         *********** BRING IN DAILY COUNT DATA ***************;
 92         
 93         DATA DAILY; SET FP;
 94         
 
 NOTE: There were 2826 observations read from the data set WORK.FP.
 NOTE: The data set WORK.DAILY has 2826 observations and 11 variables.
 NOTE: DATA statement used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 
 95         PROC SORT; BY LAKE YEAR SPECIES CAT; RUN;
 
 NOTE: There were 2826 observations read from the data set WORK.DAILY.
 NOTE: The data set WORK.DAILY has 2826 observations and 11 variables.
 NOTE: PROCEDURE SORT used (Total process time):
       real time           0.01 seconds
       cpu time            0.00 seconds
       
 
 96         PROC MEANS NOPRINT; BY LAKE YEAR SPECIES CAT; VAR CLASS; Run;
 
 ERROR: Neither the PRINT option nor a valid output statement has been given.
 NOTE: The SAS System stopped processing this step because of errors.
 NOTE: PROCEDURE MEANS used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 97         OUTPUT OUT=NEW N=N;
 98         
 
 
 99         DATA B; SET NEW;
 ERROR: File WORK.NEW.DATA does not exist.
 
 NOTE: The SAS System stopped processing this step because of errors.
 WARNING: The data set WORK.B may be incomplete.  When this step was stopped there were 0 
          observations and 0 variables.
 WARNING: Data set WORK.B was not replaced because this step was stopped.
 NOTE: DATA statement used (Total process time):
       real time           0.00 seconds
       cpu time            0.01 seconds
       
 
 
 100        PROC PRINT; VAR LAKE YEAR SPECIES CAT N;
 ERROR: Variable N not found.
 101        TITLE 'NUMBER OF FISH COLLECTED FROM PICKETT BY LAKE AND SPECIES'; RUN;
 NOTE: The SAS System stopped processing this step because of errors.
 NOTE: PROCEDURE PRINT used (Total process time):
       real time           0.00 seconds
       cpu time            0.01 seconds
       
 102        
 103        
 104        *ods rtf close;
 105        run;
 106        
 107        
 108        
 109        OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
 121        
Kurt_Bremser
Super User
96         PROC MEANS NOPRINT; BY LAKE YEAR SPECIES CAT; VAR CLASS; Run;

The premature run statement ends the proc means step, and invalidates the following output statement. Move it to the correct position where your proc means code really ends. 

PaigeMiller
Diamond | Level 26
96         PROC MEANS NOPRINT; BY LAKE YEAR SPECIES CAT; VAR CLASS; Run;
 
 ERROR: Neither the PRINT option nor a valid output statement has been given.
 NOTE: The SAS System stopped processing this step because of errors.
 NOTE: PROCEDURE MEANS used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 97         OUTPUT OUT=NEW N=N;
 98         

PROC MEANS has ended at the point in your code where the error appears (in red), and it does not have all the necessary components. What caused the PROC to come to an end? Can you figure it out?

--
Paige Miller

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 15 replies
  • 5132 views
  • 2 likes
  • 5 in conversation