DATA Step, Macro, Functions and more

ERROR 22-322: Expecting a name.

Reply
New Contributor ssv
New Contributor
Posts: 2

ERROR 22-322: Expecting a name.

Hi there, 

I'm experiencing a problem with this program. can someone help me with the solution please.

When i execute this i get error "ERROR 22-322: Expecting a name."

 

the program is here...

 

data au_sales us_sales;
infile datalines;
input #2 @10 location $ 2. @;
if location ="AU" then do;
input #1 @1 Employee_ID $ 6.
@21 Last_Name $ 18.
@43 Job_Title @ 20.
#2 @1 Salary dollar8.
@13 Hire_Date ddmmyy10.;
output au_sales;
end;
if location ="US" then do;
input #1 @1 Employee_ID $ 6.
@21 Last_Name $ 18.
@43 Job_Title @ 20.
#2 @1 Salary dollar8.
@13 Hire_Date mmddyy10.;
output us_sales;
end;
datalines;
120102 Tom Zhou Sales Manager
$108.255 AU 11/08/1973 01/06/1993
120103 Wilson Dawes Sales Manager
$87.975 AU 22/01/1953 01/01/1978
120121 Irenie Elvish Sales Rep. II
$26.600 AU 02/08/1948 01/01/1978
120122 Christina Ngan Sales Rep. II
$27.475 AU 27/07/1958 01/07/1982
120123 Kimiko Hotstone Sales Rep. I
$26.190 AU 28/09/1968 01/10/2011
120261 Harry Highpoint Chief Sales Officer
243,190 US 02/21/1969 08/01/1987
121018 Julienne Magolan Sales Rep. II
$27,560 US 01/03/1944 01/01/1974
121019 Scott Desanctis Sales Rep. IV
$31,320 US 06/25/1990 06/01/2008
121020 Cherda Ridley Sales Rep. IV
$31,750 US 02/23/1988 05/01/2006
121021 Priscilla Farren Sales Rep. IV
$32,985 US 12/10/1978 03/01/1998
;
run;

 

Log 

 
1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
61
62 data au_sales us_sales;
63 infile datalines;
64 input #2 @10 location $ 2. @;
65 if location ="AU" then do;
66 input #1 @1 Employee_ID $ 6.
67 @21 Last_Name $ 18.
68 @43 Job_Title @ 20.
___
22
ERROR 22-322: Expecting a name.
 
69 #2 @1 Salary dollar8.
70 @13 Hire_Date ddmmyy10.
71 #3;
72 output au_sales;
73 end;
74 if location ="US" then do;
75 input #1 @1 Employee_ID $ 6.
76 @21 Last_Name $ 18.
77 @43 Job_Title @ 20.
___
22
ERROR 22-322: Expecting a name.
 
78 #2 @1 Salary dollar8.
79 @13 Hire_Date mmddyy10.
80 #3;
81 output us_sales;
82 end;
83 datalines;
 
NOTE: The SAS System stopped processing this step because of errors.
WARNING: The data set WORK.AU_SALES may be incomplete. When this step was stopped there were 0 observations and 6 variables.
WARNING: Data set WORK.AU_SALES was not replaced because this step was stopped.
WARNING: The data set WORK.US_SALES may be incomplete. When this step was stopped there were 0 observations and 6 variables.
WARNING: Data set WORK.US_SALES was not replaced because this step was stopped.
NOTE: DATA statement used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds
 
83 !
104 ;
 
 
105 run;
106
107 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
Super User
Super User
Posts: 7,076

Re: ERROR 22-322: Expecting a name.

If you use a FORMAT like 20. in your INPUT statement

@43 Job_Title @ 20.

then SAS expects a variable name to precede the format.

 

Did you mean to read JOB_TITLE as a character variable? So perhaps you wanted.

68 @43 Job_Title $20.

 

 

 

New Contributor ssv
New Contributor
Posts: 2

Re: ERROR 22-322: Expecting a name.

Thank you so much Tom... I appreciate your help. By mistake i inserted @ instead of $.

Got the result now.

Thank you for your response. Have a Good one.

Ask a Question
Discussion stats
  • 2 replies
  • 148 views
  • 0 likes
  • 2 in conversation