Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PROC SQL

Status
Not open for further replies.

bryanbayfield

Technical User
Aug 10, 2001
345
EU
I'm not sure whether this is an implemntation problem or a blip with SAS.

You are meant to able in SQL as part of the SELECT ... WHERE statement to write temporary variables for display based on any one of a number of operators.

But, if you try to do this in the version embedded in SAS, it sure don't like it!

eg SELECT (LAST || ',' || FIRST) FULLNAME, AGE
FROM <DATASET>
WHERE <CONDITIONS>;


This should extract the first and last names (presented as <Lastname,Firstname>) and the age from whatever dataset you're looking at.

However, on attempting to do this, I get a few of these errors:

ERROR 22-322: Syntax error, expecting one of the following: !, !!, &, *, **, +, ',', -, /, <,<=, <>, =, >, >=, ?, AND, AS, CONTAINS, EQ, FROM, GE, GT, LE, LIKE, LT, NE, OR,^=, |, ||, ~=.

Can anyone help explain why this is happening please?

Thanks.

Bryan.
 
Hi Bryan,

I think the problem is some where in the WHERE condition statement.

Any way, the statement that U have given after the select does not contain the &quot;AS&quot; keyword, I guess.
 
Hi!

In SQL the first part of the select should read:

Select (First||','||Last) As FullName

hth
Jeff Bridgham
 
Thanks guys.

Awarding you each a star would be a bit over the top, whereas awarding a star to one of you only would smack of favouritism. So, I've awarded neither of you a star.

Hope this is OK :cool:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top