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



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

Register now

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