Hi, I would like to create SAS dataset from SQL tables using PROC SQL Pass through. I am submitting the following command but getting the errors. May I know if it is possible to create SAS Dataset form multiple DB on SQL Server using the Proc SQL Pass through? Please refer below. SAS Code: /*Get Lot Info using PROC SQL Pass-Through*/ proc sql; connect to SQLSVR as A (Datasrc=dload USER=user PASSWORD='password'); connect to SQLSVR as B (Datasrc=OPS User=user PASSWORD='password'); /*Explicit Pass-Through with SELECT*/ create table yld.Tmp_Mvmt_Dtls as select ID, OperationNumber,Code, Quantity, Status, Station , Description , Category, chrAssyYieldFlag , FlagMeasure from connection to SQLSVR (A B) ( select a.ID, a.OperationNumber,a.ode, a.Quantity, , b.Status, c.Station , c.Description , c.Category , c.chrAssyYieldFlag , b.FlagMeasure FROM [dload].[Transaction] a with (nolock) left join [sas].[Operations] b with (nolock) on a.OperationNumber = b.OperNumbers left join [sas].[Stations] c with (nolock ) on b.StationID = c.StationIDs ); ; %put %sqlxrc &sqlxmsg; *SQL Server Query return code and message; disconnect from SQLSVR; quit; LOG: /*Get Lot Info using PROC SQL Pass-Through*/ 825 proc sql; 826 827 connect to SQLSVR as A (Datasrc=dload USER=user PASSWORD='password'); 828 connect to SQLSVR as B (Datasrc=OPS User=user PASSWORD='password'); 831 832 /*Explicit Pass-Through with SELECT*/ 833 create table yld.Tmp_Mvmt_Dtls as 834 select 835 ID, OperationNumber,Code, 836 Quantity, Status, Station , Description , Category, 837 chrAssyYieldFlag , FlagMeasure 841 842 from connection to SQLSVR (A B) 843 ( - 22 76 ERROR 22-322: Syntax error, expecting one of the following: ',', EXCEPT, GROUP, HAVING, INTERSECT, JOIN, ORDER, UNION, WHERE. ERROR 76-322: Syntax error, statement will be ignored. 844 select a.ID, a.OperationNumber,a.ode, 845 a.Quantity, 846 , b.Status, c.Station , c.Description , c.Category 847 , c.chrAssyYieldFlag , b.FlagMeasure 848 FROM [dload].[Transaction] a with (nolock) 849 left join [sas].[Operations] b with (nolock) on a.OperationNumber = b.OperNumbers 850 left join [sas].[Stations] c with (nolock ) on b.StationID = c.StationIDs 851 ); 852 ; 853 %put %sqlxrc &sqlxmsg; *SQL Server Query return code and message; WARNING: Apparent invocation of macro SQLXRC not resolved. %sqlxrc 854 disconnect from SQLSVR; ERROR: Connection to the SQLSVR DBMS does not exist. 855 quit;
... View more