BookmarkSubscribeRSS Feed
MisterJenn
Fluorite | Level 6

Not understanding the errors in this datastep. Please help!

 

data hw4.bone;
infile "\\apporto.com\dfs\GWU\Users\kennedyhinnant_gwu\Downloads\Assignment 4\bone.txt";
input dob 1-10 dov 11-20 wt $ 21-26 ht 27-30 $ peri $ 31-35 
	  endo $ 35-40 tibia $ 41-44 tanner 45 sex 46;
age = (dov - dob)/365
logperi = log(peri);
run;
71   data hw4.bone;
72   infile "\\apporto.com\dfs\GWU\Users\kennedyhinnant_gwu\Downloads\Assignment 4\bone.txt";
73   input dob 1-10 dov 11-20 wt $ 21-26 ht 27-30 $ peri $ 31-35
                                                  -
                                                  22
ERROR 22-322: Expecting a name.

74         endo $ 35-40 tibia $ 41-44 tanner 45 sex 46;
75   age = (dov - dob)/365
76   logperi = log(peri);
     -------
     22
ERROR 22-322: Syntax error, expecting one of the following: !, !!, &, *, **, +, -, /, ;, <, <=, <>,
              =, >, ><, >=, AND, EQ, GE, GT, IN, LE, LT, MAX, MIN, NE, NG, NL, NOTIN, OR, ^=, |, ||,
              ~=.

77   run;

NOTE: Character values have been converted to numeric values at the places given by: (Line):(Column).
      76:15
NOTE: The SAS System stopped processing this step because of errors.
WARNING: The data set HW4.BONE may be incomplete.  When this step was stopped there were 0
         observations and 11 variables.
WARNING: Data set HW4.BONE was not replaced because this step was stopped.
NOTE: DATA statement used (Total process time):
      real time           0.15 seconds
      cpu time            0.01 seconds
1 REPLY 1
SASKiwi
PROC Star

The good old missing semicolon:

age = (dov - dob)/365; * <== Add your semicolon here;

EDIT: Wrong order in INPUT statement:

 

input dob 1-10 dov 11-20 wt $ 21-26 ht $ 27-30  peri $ 31-35 endo $ 35-40 tibia $ 41-44 tanner 45 sex 46;

 

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 16. Read more here about why you should contribute and what is in it for you!

Submit your idea!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 1 reply
  • 252 views
  • 0 likes
  • 2 in conversation