i'm still very new with SAS EG and SAS Macro.
At first i thought it was gonna be no problem to learn it, since i've got some experience in programming and databases.
But surely i was totally wrong!
Hopefully can learn a lot from more seasoned users here
PROC SQL OUTOBS=5;
CREATE TABLE &TABLE_NAME AS SELECT DISTINCT TOP5GROWTH_OF_OS_CA_INC.AccountId FORMAT=$20.,
FROM WORK.TOP5GROWTH_OF_OS_CA_INC AS TOP5GROWTH_OF_OS_CA_INC
WHERE TOP5GROWTH_OF_OS_CA_INC.ProductCategory = "GIRO" AND TOP5GROWTH_OF_OS_CA_INC.OfficeId = &officeID
GROUP BY TOP5GROWTH_OF_OS_CA_INC.OfficeId
ORDER BY TOP5GROWTH_OF_OS_CA_INC.OfficeId, TOP5GROWTH_OF_OS_CA_INC.Calculation1 DESCENDING;
/* ---END CODE---*/
I want to pass parameter through variable and create several tables, but i couldn't manage to run this code properly.
The log says:
NOTE: Line generated by the macro variable "TABLE_NAME".
44 'WORK._' ||
ERROR 202-322: The option or parameter is not recognized and will be ignored.
ERROR 22-322: Syntax error, expecting one of the following: (, AS, LIKE.
You shouldn't need to use the %put() function around the &officeID macro variable.
Try it without it. If there's still an issue you could use the %sysfunc(left(&officeId)) function to left align the office id.
As other folks have explained, macro programming and macro variable concatenation is NOT like DATA step programming or DATA step variable concatenation. This is a good introduction to the concepts of macro variable referencing and writing SAS Macro programs. http://www2.sas.com/proceedings/sugi28/056-28.pdf