BookmarkSubscribeRSS Feed
conleyi
Calcite | Level 5

I am getting an error on my code and I cannot figure out what is wrong with it. The error is keeping the code under Item 5 is not showing up in my results either. Any help would would be amazing. 

 

/* Item 1 */
PROC IMPORT
DATAFILE='/home/u45048482/sasuser.v94/LM2/FantasyBaseball2.csv'
DBMS=csv REPLACE OUT=FANTASY;
GETNAMES=YES;
RUN;

/* Item 2 */
PROC FORMAT;
VALUE Personinitial 1 = "DJ"
2 = "AR"
3 = "BK"
4 = "JW"
5 = "TS"
6 = "RL"
7 = "DR"
8 = "MF";


DATA FANTASY;
SET FANTASY;
SqrtTime = SQRT(TIME);
label Time = 'Time to make Selection (in seconds)'
Person = 'Person making selection';
SqrtTime = 'Square root of time (in seconds) to make selection';
format person Personinitial.;


/* Item 3 */
PROC SGPLOT data=FANTASY;
vbox time / group=person;
title "Comparison Boxplot: Times per Person";
title2 'Ian Conley';
RUN;

PROC MEANS data=fantasy n min max mean std median skewness kurtosis;
TITLE "Summary Statistics: Times per Person";
TITLE2 "Ian Conley";
var time;
Class person;
RUN;

/* Item 4 */
ods graphics on;
PROC GLM data=fantasy plots=diagnostics;
class person;
model time = person;
means person / BON cldiff lines;
title 'ANOVA Model: Times = Person';
title2'Ian Conley';
RUN;

/* Item 5 */
PROC MEANS data=fantasy n min max mean std median skewness kurtosis maxdec=3;
TITLE "Summary Statistics: SqrtTime per Person";
TITLE2 "Ian Conley";
var sqrtTime;
Class person;
RUN;


ods graphics on;
PROC GLM data=fantasy plots=diagnostics;
class person;
model SqrtTime = person;
means person / BON cldiff lines;
title 'ANOVA Model: SqrtTime = Person';
title2'Ian Conley';
RUN; QUIT;
3 REPLIES 3
conleyi
Calcite | Level 5

This is the Log file for the code as well 

 

1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
NOTE: ODS statements in the SAS Studio environment may disable some output features.
73
74 /* Ian Conley STA 02 */
75 /* Homework 2 */
76
77 /* Item 1 */
78 PROC IMPORT
79 DATAFILE='/home/u45048482/sasuser.v94/LM2/FantasyBaseball2.csv'
80 DBMS=csv REPLACE OUT=FANTASY;
81 GETNAMES=YES;
82 RUN;
 
NOTE: Unable to open parameter catalog: SASUSER.PARMS.PARMS.SLIST in update mode. Temporary parameter values will be saved to
WORK.PARMS.PARMS.SLIST.
83 /**********************************************************************
84 * PRODUCT: SAS
85 * VERSION: 9.4
86 * CREATOR: External File Interface
87 * DATE: 05MAR21
88 * DESC: Generated SAS Datastep Code
89 * TEMPLATE SOURCE: (None Specified.)
90 ***********************************************************************/
91 data WORK.FANTASY ;
92 %let _EFIERR_ = 0; /* set the ERROR detection macro variable */
93 infile '/home/u45048482/sasuser.v94/LM2/FantasyBaseball2.csv' delimiter = ',' MISSOVER DSD lrecl=32767 firstobs=2 ;
94 informat Round best32. ;
95 informat Time best32. ;
96 informat Person best32. ;
97 format Round best12. ;
98 format Time best12. ;
99 format Person best12. ;
100 input
101 Round
102 Time
103 Person
104 ;
105 if _ERROR_ then call symputx('_EFIERR_',1); /* set ERROR detection macro variable */
106 run;
 
NOTE: The infile '/home/u45048482/sasuser.v94/LM2/FantasyBaseball2.csv' is:
Filename=/home/u45048482/sasuser.v94/LM2/FantasyBaseball2.csv,
Owner Name=u45048482,Group Name=oda,
Access Permission=-rw-r--r--,
Last Modified=03Mar2021:10:42:15,
File Size (bytes)=1706
 
NOTE: 192 records were read from the infile '/home/u45048482/sasuser.v94/LM2/FantasyBaseball2.csv'.
The minimum record length was 5.
The maximum record length was 8.
NOTE: The data set WORK.FANTASY has 192 observations and 3 variables.
NOTE: DATA statement used (Total process time):
real time 0.00 seconds
user cpu time 0.00 seconds
system cpu time 0.00 seconds
memory 9250.79k
OS Memory 44064.00k
Timestamp 03/05/2021 10:23:45 PM
Step Count 63 Switch Count 2
Page Faults 0
Page Reclaims 462
Page Swaps 0
Voluntary Context Switches 10
Involuntary Context Switches 0
Block Input Operations 0
Block Output Operations 264
 
 
192 rows created in WORK.FANTASY from /home/u45048482/sasuser.v94/LM2/FantasyBaseball2.csv.
 
 
 
NOTE: WORK.FANTASY data set was successfully created.
NOTE: The data set WORK.FANTASY has 192 observations and 3 variables.
NOTE: PROCEDURE IMPORT used (Total process time):
real time 0.05 seconds
user cpu time 0.04 seconds
system cpu time 0.02 seconds
memory 9250.79k
OS Memory 44324.00k
Timestamp 03/05/2021 10:23:45 PM
Step Count 63 Switch Count 10
Page Faults 0
Page Reclaims 4081
Page Swaps 0
Voluntary Context Switches 77
Involuntary Context Switches 0
Block Input Operations 0
Block Output Operations 320
 
 
107
108 /* Item 2 */
109 PROC FORMAT;
110 VALUE Personinitial 1 = "DJ"
111 2 = "AR"
112 3 = "BK"
113 4 = "JW"
114 5 = "TS"
115 6 = "RL"
116 7 = "DR"
117 8 = "MF";
NOTE: Format PERSONINITIAL is already on the library WORK.FORMATS.
NOTE: Format PERSONINITIAL has been output.
118
119
 
NOTE: PROCEDURE FORMAT used (Total process time):
real time 0.00 seconds
user cpu time 0.00 seconds
system cpu time 0.00 seconds
memory 256.25k
OS Memory 38568.00k
Timestamp 03/05/2021 10:23:45 PM
Step Count 64 Switch Count 0
Page Faults 0
Page Reclaims 25
Page Swaps 0
Voluntary Context Switches 0
Involuntary Context Switches 0
Block Input Operations 0
Block Output Operations 32
 
 
120 DATA FANTASY;
121 SET FANTASY;
122 SqrtTime = SQRT(TIME);
123 label Time = 'Time to make Selection (in seconds)'
124 Person = 'Person making selection';
125 SqrtTime = 'Square root of time (in seconds) to make selection';
126 format person Personinitial.;
127
128
129 /* Item 3 */
 
NOTE: Character values have been converted to numeric values at the places given by: (Line):(Column).
125:14
NOTE: Invalid numeric data, 'Square root of time (in seconds) to make selection' , at line 125 column 14.
Round=1 Time=42 Person=DJ SqrtTime=. _ERROR_=1 _N_=1
NOTE: Invalid numeric data, 'Square root of time (in seconds) to make selection' , at line 125 column 14.
Round=2 Time=84 Person=DJ SqrtTime=. _ERROR_=1 _N_=2
NOTE: Invalid numeric data, 'Square root of time (in seconds) to make selection' , at line 125 column 14.
Round=3 Time=21 Person=DJ SqrtTime=. _ERROR_=1 _N_=3
NOTE: Invalid numeric data, 'Square root of time (in seconds) to make selection' , at line 125 column 14.
Round=4 Time=99 Person=DJ SqrtTime=. _ERROR_=1 _N_=4
NOTE: Invalid numeric data, 'Square root of time (in seconds) to make selection' , at line 125 column 14.
Round=5 Time=25 Person=DJ SqrtTime=. _ERROR_=1 _N_=5
NOTE: Invalid numeric data, 'Square root of time (in seconds) to make selection' , at line 125 column 14.
Round=6 Time=89 Person=DJ SqrtTime=. _ERROR_=1 _N_=6
NOTE: Invalid numeric data, 'Square root of time (in seconds) to make selection' , at line 125 column 14.
Round=7 Time=53 Person=DJ SqrtTime=. _ERROR_=1 _N_=7
NOTE: Invalid numeric data, 'Square root of time (in seconds) to make selection' , at line 125 column 14.
Round=8 Time=174 Person=DJ SqrtTime=. _ERROR_=1 _N_=8
NOTE: Invalid numeric data, 'Square root of time (in seconds) to make selection' , at line 125 column 14.
Round=9 Time=105 Person=DJ SqrtTime=. _ERROR_=1 _N_=9
NOTE: Invalid numeric data, 'Square root of time (in seconds) to make selection' , at line 125 column 14.
Round=10 Time=99 Person=DJ SqrtTime=. _ERROR_=1 _N_=10
NOTE: Invalid numeric data, 'Square root of time (in seconds) to make selection' , at line 125 column 14.
Round=11 Time=30 Person=DJ SqrtTime=. _ERROR_=1 _N_=11
NOTE: Invalid numeric data, 'Square root of time (in seconds) to make selection' , at line 125 column 14.
Round=12 Time=91 Person=DJ SqrtTime=. _ERROR_=1 _N_=12
NOTE: Invalid numeric data, 'Square root of time (in seconds) to make selection' , at line 125 column 14.
Round=13 Time=11 Person=DJ SqrtTime=. _ERROR_=1 _N_=13
NOTE: Invalid numeric data, 'Square root of time (in seconds) to make selection' , at line 125 column 14.
Round=14 Time=93 Person=DJ SqrtTime=. _ERROR_=1 _N_=14
NOTE: Invalid numeric data, 'Square root of time (in seconds) to make selection' , at line 125 column 14.
Round=15 Time=20 Person=DJ SqrtTime=. _ERROR_=1 _N_=15
NOTE: Invalid numeric data, 'Square root of time (in seconds) to make selection' , at line 125 column 14.
Round=16 Time=108 Person=DJ SqrtTime=. _ERROR_=1 _N_=16
NOTE: Invalid numeric data, 'Square root of time (in seconds) to make selection' , at line 125 column 14.
Round=17 Time=95 Person=DJ SqrtTime=. _ERROR_=1 _N_=17
NOTE: Invalid numeric data, 'Square root of time (in seconds) to make selection' , at line 125 column 14.
Round=18 Time=43 Person=DJ SqrtTime=. _ERROR_=1 _N_=18
NOTE: Invalid numeric data, 'Square root of time (in seconds) to make selection' , at line 125 column 14.
Round=19 Time=123 Person=DJ SqrtTime=. _ERROR_=1 _N_=19
NOTE: Invalid numeric data, 'Square root of time (in seconds) to make selection' , at line 125 column 14.
WARNING: Limit set by ERRORS= option reached. Further errors of this type will not be printed.
Round=20 Time=75 Person=DJ SqrtTime=. _ERROR_=1 _N_=20
NOTE: There were 192 observations read from the data set WORK.FANTASY.
NOTE: The data set WORK.FANTASY has 192 observations and 4 variables.
NOTE: DATA statement used (Total process time):
real time 0.00 seconds
user cpu time 0.00 seconds
system cpu time 0.00 seconds
memory 961.21k
OS Memory 39088.00k
Timestamp 03/05/2021 10:23:45 PM
Step Count 65 Switch Count 2
Page Faults 0
Page Reclaims 155
Page Swaps 0
Voluntary Context Switches 9
Involuntary Context Switches 0
Block Input Operations 0
Block Output Operations 272
 
 
130 PROC SGPLOT data=FANTASY;
131 vbox time / group=person;
132 title "Comparison Boxplot: Times per Person";
133 title2 'Ian Conley';
134 RUN;
 
NOTE: PROCEDURE SGPLOT used (Total process time):
real time 0.29 seconds
user cpu time 0.12 seconds
system cpu time 0.03 seconds
memory 20554.00k
OS Memory 53420.00k
Timestamp 03/05/2021 10:23:46 PM
Step Count 66 Switch Count 3
Page Faults 0
Page Reclaims 6705
Page Swaps 0
Voluntary Context Switches 550
Involuntary Context Switches 0
Block Input Operations 0
Block Output Operations 1216
 
NOTE: There were 192 observations read from the data set WORK.FANTASY.
 
135
136 PROC MEANS data=fantasy n min max mean std median skewness kurtosis;
137 TITLE "Summary Statistics: Times per Person";
138 TITLE2 "Ian Conley";
139 var time;
140 Class person;
141 RUN;
 
NOTE: There were 192 observations read from the data set WORK.FANTASY.
NOTE: PROCEDURE MEANS used (Total process time):
real time 0.06 seconds
user cpu time 0.05 seconds
system cpu time 0.01 seconds
memory 10062.98k
OS Memory 63168.00k
Timestamp 03/05/2021 10:23:46 PM
Step Count 67 Switch Count 3
Page Faults 0
Page Reclaims 2499
Page Swaps 0
Voluntary Context Switches 41
Involuntary Context Switches 0
Block Input Operations 0
Block Output Operations 8
 
 
142
143 /* Item 4 */
144 ods graphics on;
145 PROC GLM data=fantasy plots=diagnostics;
146 class person;
147 model time = person;
148 means person / BON cldiff lines;
149 title 'ANOVA Model: Times = Person';
150 title2'Ian Conley';
151 RUN;
 
152
153 /* Item 5 */
 
NOTE: PROCEDURE GLM used (Total process time):
real time 1.47 seconds
user cpu time 0.70 seconds
system cpu time 0.06 seconds
memory 10486.04k
OS Memory 64736.00k
Timestamp 03/05/2021 10:23:47 PM
Step Count 68 Switch Count 25
Page Faults 0
Page Reclaims 14268
Page Swaps 0
Voluntary Context Switches 2444
Involuntary Context Switches 2
Block Input Operations 0
Block Output Operations 5424
 
 
154 PROC MEANS data=fantasy n min max mean std median skewness kurtosis maxdec=3;
155 TITLE "Summary Statistics: SqrtTime per Person";
156 TITLE2 "Ian Conley";
157 var sqrtTime;
158 Class person;
159 RUN;
 
NOTE: There were 192 observations read from the data set WORK.FANTASY.
NOTE: PROCEDURE MEANS used (Total process time):
real time 0.04 seconds
user cpu time 0.04 seconds
system cpu time 0.00 seconds
memory 9065.53k
OS Memory 68632.00k
Timestamp 03/05/2021 10:23:47 PM
Step Count 69 Switch Count 3
Page Faults 0
Page Reclaims 1982
Page Swaps 0
Voluntary Context Switches 44
Involuntary Context Switches 0
Block Input Operations 0
Block Output Operations 0
 
 
160
161
162 ods graphics on;
163 PROC GLM data=fantasy plots=diagnostics;
164 class person;
165 model SqrtTime = person;
166 means person / BON cldiff lines;
167 title 'ANOVA Model: SqrtTime = Person';
168 title2'Ian Conley';
169 RUN;
 
ERROR: One or more variables are missing or freq or weight is zero on every observation.
169 ! QUIT;
 
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE GLM used (Total process time):
real time 0.00 seconds
user cpu time 0.00 seconds
system cpu time 0.00 seconds
memory 837.84k
OS Memory 60592.00k
Timestamp 03/05/2021 10:23:47 PM
Step Count 70 Switch Count 4
Page Faults 0
Page Reclaims 116
Page Swaps 0
Voluntary Context Switches 33
Involuntary Context Switches 0
Block Input Operations 0
Block Output Operations 264
 
170
171 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
183
 

 

ballardw
Super User

First suggestion until you are more comfortable with SAS coding:

No not use this type of coding:

120 DATA FANTASY;
121 SET FANTASY;

When you do that the source data set is completely replaced. So some logic errors can destroy way too much data.

Second, paste LOG and code in text boxes opened on the forum with the </>. The message windows reformat text moving some of the diagnostic characters that SAS provides for some messages in the log.

 

If these are all supposed to be labels:

123 label Time = 'Time to make Selection (in seconds)'
124 Person = 'Person making selection';
125 SqrtTime = 'Square root of time (in seconds) to make selection';

Then use only ONE semicolon at the end of all the labels:

 label 
   Time = 'Time to make Selection (in seconds)'
   Person = 'Person making selection'
   SqrtTime = 'Square root of time (in seconds) to make selection'
 ;

Or use label with each variable

 label Time = 'Time to make Selection (in seconds)' ;
 label Person = 'Person making selection' ;
 label SqrtTime = 'Square root of time (in seconds) to make selection' ;

You were getting a lot of errors because as posted you are assigning a text value to a numeric variable (SQRTTIME).

Which means that a missing value was set for SQRTTIMEbecause SAS will not let you place text, that can't be converted into a number easily, into a numeric variable. So when you use that SQRTTIME variable in the model it is missing.

 

FreelanceReinh
Jade | Level 19

Hello @conleyi and welcome to the SAS Support Communities!

 

A proven debugging strategy is to start with the first error message (or warning or suspicious note) in the log because that is often the root cause of subsequent errors. In your case the series of notes "Invalid numeric data ..." after the DATA step under "Item 2" is suspicious. Indeed, the text string 'Square root of time (in seconds) to make selection' mentioned in the log is an invalid value for a numeric variable. Which numeric variable? See line number 125 in the log: An attempt is made to assign that character value to numeric variable SqrtTime. But isn't that "assignment" just a part of the LABEL statement? No, it isn't: The LABEL statement ends prematurely due to an unwanted semicolon after 'Person making selection'! Could this be the root cause of the error later on in the PROC GLM step under "Item 5"? Yes, all values of SqrtTime were overwritten with missing values (as documented in the log: SqrtTime=.) so the dependent variable in the MODEL statement is now missing "on every observation" as the log criticizes.

 

So, deleting the semicolon in the middle of the LABEL statement should help a lot.

 

 

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

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
  • 3 replies
  • 777 views
  • 0 likes
  • 3 in conversation