DATA Step, Macro, Functions and more

Proc sql

Reply
Contributor
Posts: 50

Proc sql

hi,

 

proc sql;
create table NZ AS
Select Olympicscs1.Probability,Olympicscs1.Account_Name as Client,Olympicscs1.Champ,Olympicscs1.Last_Modified_Date as Modified,
format MMDDYY8.,Olympicscs1.Deal_Comments,Olympicscs1.Tot_Budget format dollar20., Olympicscs2.Digi_Budget format dollar20.
FROM Olympicscs1,Olympicscs2
Where Olympicscs1.Probability=Olympicscs2.Prob_Digi and
Olympicscs1.Account_Name=Olympicscs2.Account_Name and Olympicscs1.Probability NE 0
ORDER BY Olympicscs1.Probability;
quit;

 error:

Syntax error, expecting one of the following: a quoted string, !, !!, &, (, *, **, +, ',', -, '.', /, <,
<=, <>, =, >, >=, ?, AND, AS, BETWEEN, CONTAINS, EQ, EQT, FORMAT, FROM, GE, GET, GT, GTT, IN, INFORMAT,
INTO, IS, LABEL, LE, LEN, LENGTH, LET, LIKE, LT, LTT, NE, NET, NOT, NOTIN, OR, ^, ^=, |, ||, ~, ~=.

ERROR 200-322: The symbol is not recognized and will be ignored.

 

what should be the code ?

 

Frequent Contributor
Posts: 149

Re: Proc sql

Maybe the comma after "Olympicscs1.Last_Modified_Date as Modified" is the culprit.

Occasional Contributor
Posts: 8

Re: Proc sql

Hi Prateek1

 

You should drop , after  Olympicscs1.Last_Modified_Date as Modified in this way format MMDDYY8. runs for this variable, on other hand  you should write a variable for the format.

 

proc sql;
create table NZ AS
Select Olympicscs1.Probability,Olympicscs1.Account_Name as Client,Olympicscs1.Champ,Olympicscs1.Last_Modified_Date as Modified format MMDDYY8.,Olympicscs1.Deal_Comments,Olympicscs1.Tot_Budget format dollar20., Olympicscs2.Digi_Budget format dollar20.
FROM Olympicscs1,Olympicscs2
Where Olympicscs1.Probability=Olympicscs2.Prob_Digi and
Olympicscs1.Account_Name=Olympicscs2.Account_Name and Olympicscs1.Probability NE 0
ORDER BY Olympicscs1.Probability;
quit;

Super User
Posts: 7,758

Re: Proc sql

Simple code formatting lets the error stand out like a beacon:

proc sql;
create table NZ as select
  Olympicscs1.Probability,
  Olympicscs1.Account_Name as Client,
  Olympicscs1.Champ,
  Olympicscs1.Last_Modified_Date as Modified,
  format MMDDYY8.,
  Olympicscs1.Deal_Comments,
  Olympicscs1.Tot_Budget format dollar20.,
  Olympicscs2.Digi_Budget format dollar20.
from
Olympicscs1,
Olympicscs2 where Olympicscs1.Probability=Olympicscs2.Prob_Digi and Olympicscs1.Account_Name=Olympicscs2.Account_Name and Olympicscs1.Probability NE 0 order by Olympicscs1.Probability ; quit;

Writing spaghetti code is the main culprit here.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Ask a Question
Discussion stats
  • 3 replies
  • 250 views
  • 3 likes
  • 4 in conversation